Bug 24540 - cout not working when used in posix threads
Summary: cout not working when used in posix threads
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-01-22 11:27 UTC by Need Real Name
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-22 11:27:33 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Need Real Name 2001-01-22 11:27:30 UTC
The following program does not terminate. The execution gets suspended in 
the thread at the cout. 
 Is it due to buffering used in cout;Cause the same code is working fine 
with the Red hat version 6.2.

Waiting for an early reply.

#include<pthread.h>
#include<unistd.h>
#include<iostream.h>
#include<string.h>

class Thread3{
private:
char Mesg[];

static void* Fn(void* Param)
{
  char *Ptr = (char*)Param;
  cout<<Ptr<<"\n";//EXECUTION SUSPENDED AT THIS POINT
  return 0; 
}


public:

Thread3(){
 strcpy(Mesg,"Hello World");
  pthread_t tid;
  pthread_create(&tid,NULL,&Fn,(void*)Mesg);
  cout << "Thread Created" << endl;
  pthread_join(tid,NULL);
  cout << "Thread Joined" << endl;
 }
};


main(){
Thread3 t;
}

Comment 1 Jakub Jelinek 2001-01-22 11:58:34 UTC
Please install libstdc++-2.96-69 or above (this was released as gcc errata
in December).


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