Hello All - I normally don't cross-post, but in this case I thought the topic would be of interest to both the mingw32 and mingw-w64 communities.
Please let me know what you think the right list or lists would be for this topic, and I'll be happy to continue the discussion over there. This is in some sense a continuation of a discussion we were having on the mingw-w64 list: http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTimYyfZJMPLpy7chJ4u1KaJVkizvCnsmOL2w5JHL%40mail.gmail.com&forum_name=mingw-w64-public but I thought it made sense to start a new thread. I have put together a first cut at mingw support for std::thread. (For what it's worth, I've been doing this on a 64-bit windows 7 on a two-core machine.) I have done two things: The first is a native windows implementation, based on _beginthreadex, windows critical sections and windows condition variables. Rather than rewrite the std::thread code in terms of native windows calls, I have left the std::thread code essentially unchanged, and implemented in terms of windows calls the parts of the gthreads interface (__gthread_create, etc.) that are used by std::thread. As has been discussed, this will only work on something like vista or later (in particular because of the use of windows condition variables). The second, in order to have a pre-vista std::thread, is a pthreads implementation. This was really quite easy (at least with the limited amount of testing I've done so far). All that seemed to be necessary was some minor patching to std::thread and pthreads to correct a couple of incompatibilities. (This implementation has, of course, whatever licensing issues that pthreads-win32 has.) The pthreads implementation seems to work pretty much out of the box, so it might be complete, or nearly so. For the native implementation I have so far thread creation, joining, mutexes, and condition variables. This seems to work with the tests I've done so far. One notable missing feature is timed waits on mutexes (because these are not supported by the windows critical sections that I am using as the underlying native mutex). I have some questions: Where's the best place to continue this discussion? I haven't the faintest idea about how to integrate this stuff with the mingw proper. One issue (among many) is that I am ill equipped to test on anything other than 64-bit windows 7. Because my implementation works with mingw32 and mingw-w64 with essentially no differences, and because the gnu sources seem to have support for mingw -- for example, the gnu sources contain gthr-win32.h: http://gcc.gnu.org/viewcvs/trunk/gcc/config/i386/gthr-win32.c perhaps it makes sense to integrate this directly into the gnu sources, rather than as a patch specific to mingw. Any thoughts or guidance on this would be appreciated. The gnu sources have a test suite for std::thread: http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/testsuite/30_threads/ I've been running some of these manually, but it's rather tedious. It looks like those tests are designed to be run by some automated testing framework that I don't have (and don't particularly desire to set up). Is there some way I can get help testing on other platforms, and with the automated test suite? I am not sure of the best way to handle copyrights and licensing. What's the conventional wisdom on how to handle this, both for new files and for modified files? Thanks for any help and advice. K. Frank ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
