On Thu, 26 Jun 2014 09:12:30 +0200, Etienne Sandré-Chardonnal wrote: > Hi, > > Is it possible to detect the threading model (win32 / pthreads) with the > preprocessor? > > At least I would like to make the code compile in these two cases > - mingw-w64 with native win32 thread support : use win32 api - > mingw-w64 with pthreads or linux gcc : use c++11 > > Will _GLIBCXX_HAS_GTHREADS work in these cases or is this mingw-only? > > Thanks! >
The macro you reference made me curious. Gthreads (part of glib) written in C, is a wrapper around pthreads or win32 depending on how it was built. This allows for a mix of generic code that uses the wrappers and back-end specific code wrapped in #ifdef for portability. While I am aware that C++ 11 introduced a threading abstraction in- language, I am not aware of the details. Does it not internally wrap OS thread APIs? Are you trying to also mix generic C++11 threading with os specific threading sections, or just use the native os APIs? Pthreads on windows is yet another variation on a theme since it would have to wrap the win32 threading api. Even with that I believe there is still a way to mix in some straight up win32 api code if so needed. I would be interested in hearing the details form those who know. ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
