K. Frank | 5 Jun 03:08 2010

Re: How to get started with mingw multi-threaded programming

Hello All -

Apparently no c++0x threads yet...

On Tue, Jun 1, 2010 at 9:19 PM, K. Frank <kfrank29.c@...> wrote:
> Hello Keith and List -
> ...
> In a previous posting I asked:
>   Would anybody know if
>      g++ -std=c++0x
>   will give me decent thread support with mingw?  (I'm currently
>   using g++ version 4.4.1.  What if I upgrade to version 4.5?)
> It appears that linux version of g++ 4.4 supports threads, but the
> mingw version doesn't.  For example, see:
>   http://www.eggheadcafe.com/software/aspnet/35840730/summary-of-c0x-feature.aspx
> A little odd: "#include <thread>" compiles (with -std=c++0x), but
> "std::thread t;" doesn't.  The guts of the header file "thread' are
> protected by:
>   #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
> That is (more directly), will upgrading to mingw g++ 4.5 give me
> std::thread (using -std=c++0x)?
> ...

I downloaded mingw g++ 4.5, but no luck with c++0x threads.
I don't know where it would or would not be defined, but a simple


test in main shows this flag not to be defined, and this deactivates
the contents of thread.  (That is, #include <thread> compiles, but
doesn't do anything.)

>From scattered comments on the web it appears that gthreads
is a gnu wrapper for pthreads (and maybe some other threading
libraries) that hasn't been incorporated into mingw (or cygwin) yet
(even though there is a gthread-win32.c and people have built glib
for windows).

(If anybody knows more about what is going here, please chime in.)


K. Frank

ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
MinGW-users mailing list

This list observes the Etiquette found at 
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

You may change your MinGW Account Options or unsubscribe at: