看板 C_Sharp 關於我們 聯絡資訊
In C#, How do prevent a race condition when multiple threads are writing to/reading from the same variable? How do you do this in C++? 請問各位有更精簡的回答嗎? C++ static CRITICAL_SECTION cs; EnterCriticalSection(&cs); XXX(); LeaveCriticalSection(&cs); C# Static object locker=new object(); Monitor.Enter(locker); XXXX(); Monitor.Exit(locker); 謝謝^^ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.169.176.180 ※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1459335780.A.A1C.html
Litfal: 你這是什麼作業嗎zzz 03/30 19:14
ssccg: 精簡: ConcurrentQueue 03/30 19:47
※ 編輯: airjordan325 (118.169.176.180), 03/30/2016 20:49:40