Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 20934 - fstream deadlock
fstream deadlock
Status: CLOSED DUPLICATE of bug 18339
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-15 19:51 EST by Mitsuhiro Kobungyo
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-15 19:51:03 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 Mitsuhiro Kobungyo 2000-11-15 19:51:00 EST
This is Kobungyo.

Following Program is deadlocked under RedHat 7.0 when dynamic linked.
But it work correctly under RedHat6.2 in both dynamic link and static link.
Can I use fstream class from 2 or more threads simultaneously ?

$ c++ a.cc -lpthread  <- does not work
$ c++ -static a.cc -lpthread <- ok. but the object is too large.


#include <iostream>
#include <fstream>
#include <pthread.h>

using namespace std;
ofstream file;

void *func(void *){
    file << "Hello, again!" << endl;

int main(){
    file << "Hello, Wordl!" << endl;
    pthread_t t1;
    pthread_create(&t1, NULL, func, NULL);
    pthread_join(t1, NULL);
Comment 1 Jakub Jelinek 2000-11-16 06:17:31 EST

*** This bug has been marked as a duplicate of 18339 ***

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