Bug 20504 - iostream + pthreads = breakage (already fixed in rawhide)
Summary: iostream + pthreads = breakage (already fixed in rawhide)
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libstdc++   
(Show other bugs)
Version: 7.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-11-08 01:14 UTC by Need Real Name
Modified: 2008-05-01 15:37 UTC (History)
0 users

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

Attachments (Terms of Use)

Description Need Real Name 2000-11-08 01:14:21 UTC
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 13:30:33 UTC
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 16:35:10 UTC
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 17:05:19 UTC
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.