Clay, I downloaded Red Hat's Open Source POSIX Threads for Win32and built the DLL on my system. I linked it to a Pthreads program on Windows and it ran correctly. It's a pretty easy way to get Pthreads programs working on Windows. I didn't do any performance experiments but I don't expect a significant performance loss. The Red Hat Pthreads implementation just wraps equivalent Windows threading functions.
I did an experiment to test whether the Intel Thread Checker could analyze a Pthreads program on Windows. The Pthreads DLL was built with the /Qtcheck option in the Intel compiler. My test program was also built with the /Qtcheck option. Data races were deliberately introduced into the program. Thread Checker correctly identified the data races, their locations in the code, and the variables involved.
Thank you rdwells and Randy!
I did a Google search on "pthreads win32" and found the
Red Hat location for this. Unfortunately the site
wouldn't come up when I tried it, but the third link in
the Google list sent me to a Hong Kong mirror site that
It looks to be a simple DLL that you can link in with
your Pthreads source code. The README notes that you need
to choose only one from several variations of the binary
or you can take the source and compile it yourself.
If and when someone tries this library, please go ahead
and start a new topic for discussing the use of the DLL
as well as any tricks and traps that users might run into.