C++ Multithreading – Setting Thread Priority with pthread vs boost::thread on Ubuntu

boostcc++11multithreading

I wrote a class that basically executes a numerical analysis code in a thread using boost::thread. Now I need to specify the thread priority, since we are running a system with near real-time operations and don't want the OS (ubuntu) to assign a high priority to the thread.

I found that with c++11 you can actually change the priority of a thread (see here). I'm have not found such a thing for boost. Should I change my code to use the standard library option?

It used to be (and I think is valid still) that the boost libraries offered cutting edge stuff. Why in this case is not so? or am I missing something?

Best Answer

Boost may be cutting edge when it is first released.

But it (boost) should also be considered a testing ground for new ideas. The thread ideas introduced in boost were a good idea at the time and the lessons learned helped the standardization committee when they added threads to the standard.

But now that threads are part of the standard you should be using the threads from the std and start migrating your code to use the standard library.