The enclosed code hangs after printing "In parent" with *-2.96-54, but works fine with *-2.96-60. Since no compiler update has been issued for Red Hat 7, I figured I should report it as a bug. M.E.O. Enc. rh7% cat buggy.cc #include <pthread.h> #include <iostream> void * child_fn(void *) { cout << "In child" << endl; return 0; } int main() { cout << "In parent" << endl; pthread_t child_tid; if (pthread_create(&child_tid, 0, child_fn, 0) == 0) { pthread_join(child_tid, 0); } } rh7% g++ -D_REENTRANT -Wall -o buggy buggy.cc -lpthread rh7% buggy In parent ^C rh7%
We will issue an official errata once a couple of outstanding issues are resolved. In the meantime use the rawhide packages, the official errata will be their successor.
The bug is still (or again) there in gcc-2.96-65 Is there some way to get 2.96-60 somewhere? I was struggling with the same problem. An awkward fix is calling unlock(cout) after all writes.
No, the bug is not in libstdc++-2.96-65. Make sure you upgrade libstdc++ and libstdc++-devel as well as gcc*-2.96-65*.