I'm using pthreads-win32 to allow threading support for windows.
I have a cross platform project that uses pthreads and I want to make it work on windows with various compilers and different OS versions.
At least, according to the documentation pthreads-win32 should work with MSVC and even MSVC builds provided.
But I don't know if the library is tested with latest MSVC compilers like MSVC-2008 and if it is supported under 64bit windows.
From Your own experience are you aware of any issues with this library?
- Any issues with MSVC8, MSVC9, MSVC10?
- Any issues with Windows x86_64?
- Any issues with Windows Vista/Windows 7?
Notes:
- Do not even try to recommend using Boost.Thread, I'm not interested in. And I'm familiar with Boost.Thread library
- I'm not interested in reinventing the Wheel with Win32 API (that lacks RW-Locks, Conditional Variables, etc).
- I did managed to compile a projects with MSVC-2008 and MinGW GCC-4.3 and then run unit tests on it easily, using current pre-compiled DLL of pthreads.
I just need to know limitations of pthreads-win32.
Well, paxdiablo has apparently summed it up here. But from my past experience with this library, I can add a couple of things here.
Firstly, I had used a subset of the library's functions with MSVC 2008 without any problems whatsoever.
Secondly, some of my colleagues have got it going on the x86_64 (with MSVC2008 and MinGW). They haven't faced any issue either after many a cycles of beta and QA testing. Though I haven't tested it myself so can't be very sure on this one.
So by the looks of the things, it might be fit for use. The only caveat here is that if you find any issue you will be at the mercy of a not-so active mailing list (or perhaps you may want to get your hands dirty with the source code or something like that).
Can't say for certain and this may not be what you want to hear but, given that the last release is dated 2006, I'd be very wary of using this in the latest compilers. It may work but it's probably going to be up to you to get it going. There seems to be a lot of discussion about getting it working in Cygwin and MinGW but precious little for MSVC, and nothing I can find beyond MSVC2005.
Also, if you examine the CVS archives, there are precious few files that have been updated in the last year (most are two to five years ago). The couple that are dated less than a year ago have the description "Comments and code style changes" which leads me to believe none of the meat of the product has been under active development for a while.
Now maybe I'm wrong and this is just an incredibly well-written, stable product but my inner nature is more likely to conclude it's one of the bazillions of good ideas that have gone by the wayside.
And, having a look at the mailing lists, there are only seven messages posted in the first five months of 2010 (the earliest of which has been unanswered for four months) and only 59 for the whole of 2009. Colour me sceptical but that doesn't seem like a massively vibrant support community.
There seems to be a patch for 64-bit Windows (see here in the 2010 archives) but, again, this appears to have problems which are unanswered since February and it only mentions support for MinGW:
... this patch (a bit rough and need some final cleaning up and some extension to the test run makefile for allowing CROSS here) enables pthread to be build for the x86_64-pc-mingw32 target.
This is not the sort of thing I'd be using for my mission-critical software.
And I know you stated that you're not interested in re-inventing the wheel but you can implement multi-reader locks and condition variables from the more basic primitives quite easily - I even had a multi-reader scheme that solved the write starvation problem in a way that almost got me a patent (not that I agree with software patents but my employer insists they're valuable).
And if the only wheel you have has half its spokes missing and is horribly bent out of shape, you may just need to reconsider :-)
In any case, Vista and Server2k8 introduced both condition variables and slim reader/writer locks. Thread-local storage has been around since Win2k. I know that won't help if you still need to support XP but I'd be looking to the future.
And since you seem to have defined portability as "Windows-only", and all the features you want are available in the current versions, I'm not sure I see an advantage to sticking with pthreads. If you wanted portability to POSIX, yes, but that doesn't seem to be the case here.
Surprised that nobody has suggested Intel's Thread Building Blocks. They're very active and support virtually everything, with the newest release being less than two weeks ago, and C++0x features if you use a compliant compiler.
来源:https://stackoverflow.com/questions/2797690/portability-of-pthreads-win32-over-various-windows-compilers