Showing posts with label critical sections. Show all posts
Showing posts with label critical sections. Show all posts
Thursday, April 21, 2011
Difference between Mutexes and Critical Sections
They are different synchronization mechanisms. A mutex has thread affinity, a specific thread owns the mutex. A critical section is "first-come-first-serve". A critical section is not waitable like a mutex. Calling WaitForSingleObject() for a mutex on the thread that owns it immediately succeeds. If the mutex is owned by another thread, it won't return until the mutex is released.
Subscribe to:
Posts (Atom)