// Demonstrates bug in boost::cb_details::debug_iterator_registry // The copy constructor of boost::circular_buffer appears to not be threadsafe // due to lack of thread safety in boost::cb_details::debug_iterator_registry. // Compile command: g++ cb.cpp -lboost_thread // Add this line to remove seg fault: // #define BOOST_CB_DISABLE_DEBUG #include #include boost::circular_buffer data(4096); void thread_fn() { while(1) { boost::circular_buffer c(data); // Seg fault in here } } int main() { boost::thread t1(thread_fn); thread_fn(); }