mingw support for c++11 concurrency

Does anybody know when mingw will support the concurrency parts of c++11?

Currently you cannot use std::thread or std::async. These are available in g++ on Linux.

my g++ version: 4.7.0
https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.c++.moderated/qZ2080kofbc
I see you're attempting to compile under MinGW. Try:

#include <thread>
#include <iostream>

int main()
{
#if !defined(_GLIBCXX_HAS_GTHREADS)
std::cout << "glib doesn't have gthreads on my platform\n";
#endif
}


when it is defined, MinGW will support std::thread :]

I believe the reason it doesn't support threads yet is that no version of std::thread has been made that uses the win API, I don't know when they plan to implement it though.

If you use G++ under cygwin(linux..emulator? I'm hesitant saying emulator, but you get the picture) it should work.
Last edited on
If you're "brave", there's this patch

Enabling std::thread and friends in MinGW GCC 4.7
http://tehsausage.com/mingw-std-thread-gcc-4-7

I've not tried it, but have been wondering about it...

Andy
Last edited on
Use boost if you really need a cross platform solution or change your code.
Thanks for the responses, really appreciate it.

Zephilinox :

tried your suggestion and it looks like mingw does not support std::thread at all.

andywestken:

great link! I followed the steps on the page and std::threads, std::mutex now work. However std::future and std::async are still broken.

modoran:

1. I want to play around with c++11 concurrency.
2. c++11 concurrency implementations are available on other platforms (mac, linux, etc..). only window seems to be missing it.
3. I know of boost's concurrency features.

thanks for the help.
Topic archived. No new replies allowed.