Bjorn Roche wrote:I have a bunch of multithreaded C++ code (using pthreads, unix style mutexes, OS specific memory barriers and such). Does your book cover strategies for porting existing C++ code to the new C++11 standard? Or is it simply a matter of replacing constructs one at a time? Any general advice?
There is an appendix which shows the correspondence between various
thread libraries (including POSIX threads) and the C++11 thread library, and the relevant chapter for details, but no specific advice about porting. I would go for a piecemeal approach, replacing each construct in turn: code that uses the C++11 thread library should work quite nicely alongside code that uses the raw platform API, and
you should be able to use POSIX mutexes on threads spawned with
std::thread, and
std::mutex on threads spawned with
pthread_create (for example).