Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
I've got a question regarding threads. As far as I can tell, there are three ways of using threads in c++:
- pthreads (pretty crossplatform I believe)
- std::threads from c++0x (is this available in mingw?)
- OpenMP: very crossplatform, even MSVC supports it out of the box. Is this available in mingw-w64?
What's the easiest/best way? I just need some form of parallel execution of a set of system(…) commands, nothing more.
> - OpenMP: very crossplatform, even MSVC supports it out of
> the box. Is this available in mingw-w64?
Yes, it is libgomp, which in turn relies internally on pthreads.
You're using my builds, so you have it already: Just extract
the pthreads package in the distribution into the same directory
it already is in, you will be ready to go.
All right, my "research" was leading me in that direction :). Is there any ETA on std::threads in gcc/mingw or is that something for in the distant future?
I don't know anything about std::threads thingies at all and I wasn't suggesting that you must use openmp, I was merely answering to your question about whether openmp is supported with mingw-w64. You can always use window$ own api for your multithreaded apps, too.
I know, but whats easier than this:
#pragma omp parallel for
I'm not going to make that harder than it needs to be ;). I hate native API's by the way, always so intimidating and hard to get right.
FYI: One of my enhancement items that I was looking at potentially doing is supporting libgomp without pthreads (native win32). It looks like it may be doable (with some minor rearrangement of the thread creation and a couple other things). I have only taken a cursory look to see how bad it will be (and since I'm doing it cleanroom style, it obviously it's a bit slow going because I can't remember half of the semantics of the pthreads functions hehe ;-)). It's low priority for me because most of the things that I have been doing is compatibility and build type things and I'm unsure of the interest in it especially since it works OOB if pthreads dll is installed…
(The reason for this desire on my part is the licensing of the pthreads library ;-))
Well, firstly, in my code snippet, it would have to be #include <omp> :D
Secondly: Won't win32 threads be faster on Windows (hence "native") and allow for a more independent future implementation of std::threads? Or am I going totally haywire here…