推 purpose:The Old New Thing 網站那篇文中的 AddToString 函數不就 11/20 12:22
→ purpose:已經證明,可以是 thread safe 但不滿足 re-entrant 了 11/20 12:23
→ descent:是因為那個全域變數 s 的關係嗎? 11/20 12:33
推 yvb:AddToString('\0')跟AddToString('\\')是假設要處理卻會出問題 11/20 12:43
→ yvb:拿一個有bug的code來說明很怪... 11/20 12:43
推 Ebergies:因為 thread-safe 不保證同個 thread 多次進入不會出問題 11/20 12:59
→ Ebergies:簡單的例子, 當收到 SIGNAL 的時候有可能你正在 lock 裡 11/20 12:59
→ Ebergies:結果 handler 又 call 一次你的 thread safe func 就炸了 11/20 13:00
這不是說明前一個 thread 還沒取得 lock, 後一個 thread 才會完成取得 lock 的動作,
並順利執行, 這樣會有問題嗎?
※ 編輯: descent 來自: 59.125.239.51 (11/20 14:42)
推 HuangTzHuan:Ebergies 的意思是「同一個」thread 喔 11/20 18:46
→ jackace:假設你的程式在釋放mutex前就遞迴就沒法reentrant啦 11/20 22:01
→ adrianshum:文中提到re-entrant 比thread-safe更強,是不是可以理 11/25 09:00
→ adrianshum:解為 reentrant必為thread-safe? 有thread-unsafe 但 11/25 09:01
→ adrianshum:reentrant 的例子嗎? 11/25 09:01
→ adrianshum:怪的是文中說either, 但圖卻是reentrant 是threadsafe 11/25 09:04
→ adrianshum:的子集(即不存在reentrant 但non-thread-safe) 11/25 09:05