Web lists-archives.com

Re: [Mingw-users] new thread library aimed at c++11 and later development.

Hi Eli!

On Sat, Jul 9, 2016 at 3:36 AM, Eli Zaretskii <eliz@xxxxxxx> wrote:
>> From: ralph engels <ralphengels@xxxxxxxxx>
>> Date: Wed, 6 Jul 2016 01:53:21 +0200
>> I will try, atm we just need to know if the gcc i have built works on
>> windows versions older than vista,
>> ...
>> No need to run the entire gcc suite as atleast one c++ test is known to
>> fail, but that test might be suspect.
> I can run the single test program mentioned there, but I'd appreciate
> more details, as I don't normally use C++ in my personal work.
> A list of test programs to compile, the non-default command-line
> switches to compile them, how to run them, and what results to expect
> will be greatly appreciated.

Disclaimer:  This info is five or six year old, I did not do this on xp
(rather 64-bit windows 7), I think I did this with mingw-w64 (although
I might have also run it with mingw), and I used a hand-patched
version of gcc prior to either mingw or mingw-w64 offering support
for std::thread.

I downloaded the source code for (part of?) the gcc std::thread test
suite from:


I also had to download testsuite_hooks.h (and maybe also all.h) from


(and http://stuff.mit.edu/afs/athena/software/gccgo_v4.50/gccgo/libstdc++-v3/testsuite/util/thread/all.h).

I do not believe that I had to download or use testsuite_hooks.cc.

The first test program I tried was 1.cc.  I compiled it as follows:

-D_GLIBCXX_HAS_GTHREADS -enable-stdcall-fixup -enable-auto-import
-std=c++0x -I.. -o 1 1.cc

I think that some of these command-line argument should not be
necessary for you.  From memory:

   -D_GLIBCXX_ASSERT   causes the test code's VERIFY macro to become a
      run-time assertion
   -D_GLIBCXX__EXP_THREADS    tells gcc to use my gthreads implementation that
      supports my experimental std::thread implementation
   -D_GLIBCXX_HAS_GTHREADS   needed to turn on gthreads in gcc
   -enable-stdcall-fixup   I think this was a work-around for some
windows gcc issue
      that presumably no longer exists
   -enable-auto-import  again, a work-around that is probably no
longer necessary
   -std=c++0x   turn on c++11 to enable std::thread
   -I..   tell gcc to search my current working directory to find

   -o 1 1.cc   compile 1.cc and output executable to 1.exe

In short, the only command-line arguments I think you would need would
be -D_GLIBCXX_ASSERT, -std=c++11 (or maybe std=c++14), unless
your version of gcc defaults (finally) to using c++11 / c++14, and -I ..,
or equivalent, to make testsuite_hooks.h available.  All the other stuff I
think are no-longer-relevant work-arounds and stuff special to my patched
gcc installation.

>From memory, I did not have to modify any of the test suite code.  I just
had to manually download, compile, and run it, independently of the testing
framework that I didn't bother to port / set up.

I think some of the tests are supposed to "fail" (assert) as the condition
for success.

I also ran the test-suite program, typesizes.cc that tested whether a pointer
to a thread handle had the same size as the thread handle itself.  This is a
weird test that did not pass for me, and I did not expect it to pass.  This may
be related to the issue that, although not required by posix,
unix-world pthreads
uses a scalar type (a pointer) as its (nominally opaque) thread handle, and much
pthreads-using code in the wild (including gcc's std::thread) depends on this.
pthreads-win32, however, uses a non-scalar struct for the handle.  I got around
this by patching gcc's std::thread to work with a non-scalar thread handle.
(mingw-w64 elected to write winpthreads that follows the de facto unix-world
standard of using a scalar handle, and use that to support std::thread.)

I hope this of some use to you, but beware that this is all 5+ years old.
These comments may no longer be relevant to the current test-suite code
(and the source-code links I gave above may or may not still be in service).


Happy Multi-Threaded Hacking!

K. Frank

Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
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:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe