Functionality deference is sure -- CMutex
maps directly to Win32 mutex type while std::mutex
is way more basic, likely implemented using win32 CRITICAL_SECTION
removing the recursive nature and std::recursive_mutex
wrapping CRITICAL_SECTION
. Those would work similar to CCriticalSection
.
CMutex
is a heavyweight that in practice is used to create named mutexes for interprocess communication. You should not use it intraprocess.
If your question stand comparing recursive_mutex
vs CCriticalSection
, I'd bet on practically same performance. Interface-wise CSingleLock
has completely braindead interface (it takes a second argument that defaults to FALSE
instead of TRUE
), so in practice I never used it directly only through macro to avoid mistake.
In new code I'd first try to solve things using std::future
, and fiddle with locks only as last resort. The C++11 threading makes perfect sense to use, so until you need CMultiLock
functionality it is better. I did not yet explore how to cover the latter case, but would be surprised if it can't be done easily.