Reputation: 1275
I'm using MinGW_W64, and I'm having trouble deciding how to move forward with the "threading" option. I can use either posix threads, or win32 threads. So far I've been using C++11's "std::thread" for my threading (which requires the posix threads option), and I really like the interface doing things this way. However, I've read from multiple sources that posix threads are significantly slower than win32 threads, and performance is a big concern for me.
My project will eventually be multi-platform, but for now my primary development machine is running Windows 7.
My question is: Are MinGW_W64's posix threads slower than the win32 threads? If so, how would I go about writing a wrapper that would let me using an std::thread-like interface but using win32 threads under the hood (or finding such a wrapper if someone's already written one)?
Upvotes: 2
Views: 3502
Reputation: 1439
There is already a lightweight native implementation of std::thread and sync primitives for MinGW, implemented in pure WINAPI: https://github.com/meganz/mingw-std-threads
It's a header-only lib and should work with any version of MinGW that has proper C++11 support.
Upvotes: 3