Bug 20504 - iostream + pthreads = breakage (already fixed in rawhide)
iostream + pthreads = breakage (already fixed in rawhide)
Product: Red Hat Linux
Classification: Retired
Component: libstdc++ (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2000-11-07 20:14 EST by Need Real Name
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-11-07 20:14:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2000-11-07 20:14:21 EST
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.



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
Comment 1 Jakub Jelinek 2000-11-08 08:30:33 EST
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.
Comment 2 Rene van Paassen 2000-12-13 11:35:10 EST
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. 
Comment 3 Jakub Jelinek 2000-12-13 12:05:19 EST
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*.

Note You need to log in before you can comment on or make changes to this bug.