Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Porting pre-C++11 code

 
Bjorn Roche
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there,

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? Thanks, and welcome to the ranch!

bjorn
 
Anthony Aj Williams
author
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic