Reputation: 849
I need to perform on a multi-core architecture a huge quantity of relatively short tasks. For this I wanted to use a fixed size thread pool and some reliable implementation of an executor.
I was reading about boost::asio and io_service in this post How to create a thread pool using boost in C++? but this uses boost threads, while in many places my code uses the c++11 thread_local modifier for local variables (for performance reasons), hence I suppose I'm forced to use c++11 threads.
Is the boost thread implementation compatible with c++11 thread_local variables?
Is it safe to just use the io_service::run method with c++11 threads, instead that with boost::thread?
Upvotes: 0
Views: 1325
Reputation: 977
Is it safe to just use the io_service::run method with c++11 threads, instead that with boost::thread?
Yes, I use std::thread
with boost::asio
and it works fine. I also use std::bind
instead of boost::bind
. You can find an example here
Is the boost thread implementation compatible with c++11 thread_local variables?
I don't know about that, but it should be irrelevant if you use std::thread
Upvotes: 3