I'm on MacOSX, writing an app in C++.
What threading library should I use? pThreads? or is there something else?
Thanks!
I'm on MacOSX, writing an app in C++.
What threading library should I use? pThreads? or is there something else?
Thanks!
Consider using something cross-platform, like Boost.Thread (one advantage of Boost.Thread is that it is very similar to the thread library proposed as part of C++0x, so in the future, moving will be simpler).
On MacOSX, POSIX threads in C/C++ and NSThread in Objective-C/C++ are the recommended solutions - see Thread Management for an overview.
In C++ though a cross-platform API as recommended by James is better if portability might ever become an issue.
If your application can stand to run only on OS 10.6 you should use Grand Central Dispatch. Apple's new threading system is built right into the operating system so the threads are managed for the best overall system performance.