C
C#7mo ago
Tony Wang

Monitor Signaling

I have some code where someone used the Monitor Class to signal between two threads. It looks very similar to the code in the top reply in: https://stackoverflow.com/questions/1355398/monitor-vs-waithandle-based-thread-sync I am planning to convert the code using EventWaitHandle instead, but I want to understand the solution first and I have troubles understanding why they used "while (!signalSet)" instead of "if(!signalSet)". Is there a difference in that case? if yes, what is the difference and if no, is there any reason to write while?
Stack Overflow
Monitor vs WaitHandle based thread sync
I was under the impression, after reading this article that it is better to use Monitor/Lock for thread synchronisation as it does not use native resources Specific quote (from page 5 of the articl...
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server