- error compiling simple threading example... - 7 Updates
- How to call C function/library in C++ - 3 Updates
- Onwards and upwards - 1 Update
- size_t - 5 Updates
- How to get signed zeros in C++/C? - 3 Updates
- What problem does this self-assignment function have? - 1 Update
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 11:09AM -0700 > "Doug Mika" wrote in message > news:4ab0c845-49e5-4370-8a4f-ba0de590aa7b@googlegroups.com... [...] > So I came upon a little program to test whether MinGW > supports threads on windows platforms: [...] MingW does indeed support C++11 threads on Windows Doug. FWIW, here is the one I am using: http://tdm-gcc.tdragon.net |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 10 07:59PM +0100 On Wed, 10 Jun 2015 08:30:51 -0700 (PDT) > Unfortunately mine doesn't. So here is a question, does anyone know > of a work around for this problem on MinGW or better yet, is there > even a windows compiler that supports all the defined C++11 standards? Given the name clash it is an easy mistake to make, but your test has nothing to do with glib, which is a C library providing cross-platform support for various programming utilities (and which is connected with the GTK+ UI toolkit). Instead it is an indication of whether your g++/libc implementation supports threads for the particular gcc distribution in question. Clearly yours doesn't. You probably need to get a different MinGW package. Beyond that I cannot help, as I have never used MinGW. Chris |
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 01:16PM -0700 > news:ml9ugq$mgj$1@speranza.aioe.org... > > "Doug Mika" wrote in message > > news:4ab0c845-49e5-4370-8a4f-ba0de590aa7b@googlegroups.com... [...] > > So I came upon a little program to test whether MinGW > > supports threads on windows platforms: [...] > MingW does indeed support C++11 threads on Windows Doug. > FWIW, here is the one I am using: > http://tdm-gcc.tdragon.net Heck, it even supports thread_local keyword. A modified version of your original example: ____________________________________________________________ #include <iostream> // std::cout #include <thread> // std::thread, std::this_thread::sleep_for #include <chrono> // std::chrono::seconds static thread_local int g_tls = 0; void pause_thread_call() { std::cout << "pause of " << g_tls << " seconds ended\n"; } void pause_thread(int n) { g_tls = n; std::this_thread::sleep_for(std::chrono::seconds(n)); pause_thread_call(); } int main() { std::cout << "Spawning 3 threads...\n"; std::thread t1(pause_thread, 1); std::thread t2(pause_thread, 2); std::thread t3(pause_thread, 3); std::cout << "Done spawning threads. Now waiting for them to join:\n"; t1.join(); t2.join(); t3.join(); std::cout << "All threads joined!\n"; return 0; } ____________________________________________________________ ;^) |
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 01:25PM -0700 > "Doug Mika" wrote in message > news:4ab0c845-49e5-4370-8a4f-ba0de590aa7b@googlegroups.com... [...] > So here is a question, does anyone know of a work around for > this problem on MinGW or better yet, is there even a windows > compiler that supports all the defined C++11 standards? You can go for a visual studio download here: |
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 01:28PM -0700 > news:mla6f4$cic$1@speranza.aioe.org... > > "Doug Mika" wrote in message > > news:4ab0c845-49e5-4370-8a4f-ba0de590aa7b@googlegroups.com... [...] > > this problem on MinGW or better yet, is there even a windows > > compiler that supports all the defined C++11 standards? > You can go for a visual studio download here: OOPS! I forgot to post the darn link: First, think about getting a windows live account which is required to activate the product. Then go here: https://www.visualstudio.com Click on the green button that says free in the upper right hand corner of the screen. Actually, msvc 2013 is not all that bad. Its debugger happens to be very nice. |
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 02:15PM -0700 > news:mla6f4$cic$1@speranza.aioe.org... > > "Doug Mika" wrote in message > > news:4ab0c845-49e5-4370-8a4f-ba0de590aa7b@googlegroups.com... [...] > > this problem on MinGW or better yet, is there even a windows > > compiler that supports all the defined C++11 standards? > You can go for a visual studio download here: Beware, msvc 2013 has better support for C++11 when compared to C11. Simple example, I cannot get `_Thread_local' to work, however `thread_local' works fine... damn. |
"Chris M. Thomasson" <nospam@nospam.nospam>: Jun 10 02:38PM -0700 > "Chris M. Thomasson" wrote in message > news:mlaa23$lft$1@speranza.aioe.org... [...] > Simple example, I cannot get `_Thread_local' to work, however > `thread_local' works fine... > damn. Sorry for all of the pesky posts... However, I made a mistake wrt the information above. MSVC 2013 does appear to support the `thread_local' keyword. There is a rather ugly workaround, something like: ________________________________________________ // `thread_local' keyword "workaround" for MSVC, damn! #if defined (_MSC_VER) # if (_MSC_VER <= 1800) # define thread_local_storage __declspec(thread) # else // assume more recent versions of msvc has `thread_local'... # define thread_local_storage thread_local # endif #else # define thread_local_storage thread_local
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment