[cfe-dev] [libc++] Porting libc++ to Windows
Nico Rieck
nico.rieck at gmail.com
Fri Jul 3 10:25:51 PDT 2015
On 02.07.2015 13:27, Nikola Smiljanic wrote:
> What David said makes sense, I was looking at std::mutex implementation two
> days ago and turns out that Microsoft used critical section in VS 2010 but
> changed it to something custom later on. I don't know the exact details but
> the only reason I could come up with was that they couldn't meet all the
> standard requirements for std::mutex. [...]
I think it had more to do with integrating the threading primitives into
the concurrency runtime. And I found it to be painfully slow when used
alone.
You don't need EnterCriticalSection with a timeout to implement a timed
mutex, the condition variable available since Vista works fine. The new
VS2015 runtime has actually three implementations: one at the Win7 level
(using SRWLOCK), one at the Vista API level (with CRITICAL_SECTION),
and one based on the Concurrency runtime. But these are only used for
the C11-like mutex, the C++ runtime now uses condition variables.
--Nico
More information about the cfe-dev
mailing list