Bug 24540 - cout not working when used in posix threads
cout not working when used in posix threads
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-22 06:27 EST by Need Real Name
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

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


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-01-22 06:27:30 EST
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 06:58:34 EST
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.