Hello All!

On Sun, Mar 23, 2014 at 6:13 PM, JonY <j...@source.net> wrote:
> On 3/24/2014 01:20, Adrien Nader wrote:
>> On Sun, Mar 23, 2014, LRN wrote:
>>>> * Win32 threading * POSIX threading
>>>
>>> It's a matter of adding native-W32-threads-using code to GCC. Doing
>>> that will remove winpthreads dependency. So far no one seems to be
>>> bothered enough to code this.

I did do this on an experimental basis a few years back. I didn't
do exhaustive testing, but according to my basic tests, all of
std::thread was working.  (That was my goal.)

The implementation used windows critical sections for mutexes,
and windows condition variables for condition variables.  The only
feature that didn't map neatly to the windows api in this scheme
was std::timed_mutex, but with some extra work I was able to
implement std::timed_mutex in terms of critical sections.

>> The main difficulty is in handling all the OS versions and it's not
>> always that easy.
>>
>
> iirc there was some work done some time ago using win32 native
> threading,

Yes, as described above.

> but it will cut off XP users completely due to how
> conditional variables are only available in Vista and later.

Yes, windows condition variables are not supported in xp, so the
above scheme only works for vista and later.

My goal was to get gcc's std::thread working on windows, and the
windows-api-based implementation accomplished this.  But it's fair
to say that even though pthreads is not part of the c++ standard
(and I use std::thread in preference to pthreads for my own code),
pthreads is very widely used.  So although mingw-w64 doesn't need
pthreads for c++11 compliance, it's clearly very valuable to ship a
mingw-w64 that supports pthreads.  And once you've done that, why
not base std::thread on pthreads?  Is there really any value is shipping
two versions of std::thread?  From my perspective (that of using
portable, standard c++11 std::thread for threading), as long as
std::thread works, I really don't care whether std::thread is based
on pthreads or not.

But I would really NOT want a version of mingw-w64 that only supported
part of the c++11 standard, i.e., that didn't support std::thread.


Happy Multi-Threaded Hacking!


K. Frank

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to