http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54185
--- Comment #6 from architectbum at hotmail dot com 2012-08-06 17:18:26 UTC --- I don't have this_thread::sleep_for in my build, but presumably it wouldn't help as the segfault comes inside the pthread_cond_wait function. The testcase as written already ensures that NUM_THREADS-1 threads are actually waiting at cond->wait when notify_all is called (thanks to the lock); the problem seems to be a race between the final thread doing 'delete cc' and the other threads clearing the part of pthread_cond_wait which assumes the condition variable's address still points to a valid object. To be clear, this isn't a bug with pthread, just the way which libstdc++ uses it. If/when ~condition_variable (via delete) calls gthread_cond_destroy, libpthread properly avoids the race.