简体   繁体   中英

Is it safe to use boost::lockfree with c++11 thread support library?

I currently have a code written using C++ 11 thread support library: http://en.cppreference.com/w/cpp/thread

I am wondering whether it would be safe to mix that code with boost::lockfree. http://www.boost.org/doc/libs/1_54_0/doc/html/lockfree.html

That is, I want multiple C++11 std::threads to concurrently access boost::lockfree::queue. Probably it would be safer to replace C++11 thread with boost::thread, but if I could minimize the code change it would be nice.

I am currently working on a threadpool implementation myself using a lockfree queue and std::thread however I am using the Joe Seigh atomic queue algorithm rather than the boost version. I can see no reason why the boost version would not be fine, I've examined the source and it seems an excellent implementation to me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM