Last post Feb 01, 2018 02:45 AM by Cathy Zou
Jan 31, 2018 07:39 PM|vinodkpasi|LINK
What is the difference between Mutex and lock keyword?
Jan 31, 2018 07:57 PM|PatriceSc|LINK
Mutex are using a name so you could even ensure a resource is accessed exclusively accross multiple EXE files written using various languages while lock is inside your app only.
https://www.onlinebuff.com/article_understand-monitor-vs-mutex-vs-semaphore-vs-semaphoreslim-onlinebuff_60.html seems to discuss
all that quite well.
You had also a very good resource about C# threading but can't find it right now...
Edit; found it at www.albahari.com/threading/
Feb 01, 2018 02:45 AM|Cathy Zou|LINK
The lock construct is faster and more convenient. Mutex, though, has a place in that its lock can span applications in different processes on the computer.
A Mutex is like a C# lock, but it can work across multiple processes. In other words, Mutex can be computer-wide as well as application-wide.
A lock is specific to the AppDomain, while Mutex to the Operating System allowing you to perform cross-process locking and synchronization.