Is it smart to replace boost::thread and boost::mutex with c++11 equivalents?

There are several differences between Boost.Thread and the C++11 standard thread library: Boost supports thread cancellation, C++11 threads do not C++11 supports std::async, but Boost does not Boost has a boost::shared_mutex for multiple-reader/single-writer locking. The analogous std::shared_timed_mutex is available only since C++14 (N3891), while std::shared_mutex is available only since C++17 (N4508). C++11 timeouts are different … Read more

System-wide mutex in Python on Linux

The “traditional” Unix answer is to use file locks. You can use lockf(3) to lock sections of a file so that other processes can’t edit it; a very common abuse is to use this as a mutex between processes. The python equivalent is fcntl.lockf. Traditionally you write the PID of the locking process into the … Read more

Why doesn’t Mutex get released when disposed?

The documentation explains (in the “Remarks” section) that there is a conceptual difference between instantiating a Mutex object (which does not, in fact, do anything special as far as synchronization goes) and acquiring a Mutex (using WaitOne). Note that: WaitOne returns a boolean, meaning that acquiring a Mutex can fail (timeout) and both cases must … Read more

What are the differences between various threading synchronization options in C#?

Great question. I maybe wrong.. Let me try.. Revision#2 of my orig answer.. with a little bit of more understanding. Thanks for making me read 🙂 lock(obj) is a CLR construct that for (intra-object?) thread synchronization. Ensures that only one thread can take ownership of the object’s lock & enter the locked block of code. … Read more