Thread Synchronization – Mutex Explained With Simple Example
A Mutex is basically a lock that is locked before accessing any critical section of code to ensure only one thread at a time can access it. Mutex is unlocked when the thread is done processing. Thus, mutex can also be thought as “Mutually exclusive flag” to ensure all other threads are blocked to a certain section of code when one thread is already accessing it.
(more…)