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

Kim Gräsman kim.grasman at gmail.com
Thu Jul 2 13:27:05 PDT 2015


Hi David,

Right you are, I didn't know std::mutex had timed waits. Sorry for the
disinfo.

- Kim
Den 2 jul 2015 11:44 skrev "David Chisnall" <David.Chisnall at cl.cam.ac.uk>:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150702/7e7eb154/attachment.html>


More information about the cfe-dev mailing list