...

/

Advantages and Problems with Mutex

Advantages and Problems with Mutex

Learn about the important advantage of mutex over the synchronized block as well as the problems with mutex.

Advantage

The vital advantage of mutex over a synchronized block is that we suspend a coroutine instead of blocking a thread; this is a safer and lighter approach. Compared to using a dispatcher with parallelism limited to a single thread, a mutex is lighter, and in some cases, it might offer better performance.

Problems

On the ...