[cfe-dev] [libc++] Porting libc++ to Windows

Nikola Smiljanic popizdeh at gmail.com
Thu Jul 2 04:27:47 PDT 2015


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. This thread has a bit more info
https://social.msdn.microsoft.com/Forums/vstudio/en-US/3a9387ed-f15f-4b80-944e-180f41980a2c/stdmutex-performance-compared-to-win32-mutex-or-critical-section-apis?forum=vcgeneral

On Thu, Jul 2, 2015 at 8:02 PM, Dennis Luehring <dl.soluz at gmx.net> wrote:

> isn't boots threads implementation the best place to look for
> windows/posix related implementations - because there are currently c++11
> <thread> conform on these platforms?
>
> it would be sad to see libc++ development go through the same
> system-specific-bugs/special behaviour research again
>
> http://www.boost.org/doc/libs/1_58_0/doc/html/thread.html
> http://www.boost.org/doc/libs/1_58_0/doc/html/thread/changes.html
>
> Am 02.07.2015 um 11:44 schrieb David Chisnall:
>
>> On 2 Jul 2015, at 10:33, Kim GrÀsman <kim.grasman at gmail.com> wrote:
>> >
>> > Windows also has a light-weight mutex concept they call critical
>> > sections, it's been around since forever. That's what std::mutex
>> > should map to, not the Windows Mutex.
>>
>> Unless Iâ  m missing something (and I may well be - last time I wrote any
>> Win32 code, NT 5 was in beta), CriticalSection objects can not:
>>
>>   - Specify a timeout after which theyâ  ll stop blocking (maybe you can
>> do this by combining TryEnterCriticalSection and WaitForSingleObject?)
>>
>>   - Be atomically released when waiting on a condition variable and
>> reacquired
>>
>> Both of these are required for std::mutex.  SRWLocks support the second,
>> though donâ  t seem to provide a clean way of implementing the first.
>>
>> David
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150702/01c3e84b/attachment.html>


More information about the cfe-dev mailing list