Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#107 closed enhancement (duplicate)

crash in threads with cerr-usage when cin is a pipe

Reported by: anonymous Owned by: bird
Priority: low Milestone:
Component: libc Version: 0.6
Severity: minor Keywords:
Cc:

Description

Hi,

when I run the following program compiled with gcc 3.3.5 CSD1 and a input redirection I get SYS1808 with code 0005.

#include <iostream>
using namespace std;

void threadfunc(void*)
{  cerr << "in thread\n";
}

int main()
{  cerr << "before beginthread\n";
   _beginthread(threadfunc, NULL, 65536, NULL);
   cerr << "after beginthread\n";
   return 0;
}
D:\TEMP>gcc test.cpp -lstdc++

D:\TEMP>type test.cpp | test.exe
before beginthread
aifnt etrh rbeeagdi
ntSYS1808:
Der Prozeß wurde gestoppt. Der Softwarediagnosecode
(Fehlercode der Ausnahmebedingung) ist 0005.

Of course, the output to cerr is not serialized, but this does not matter. I removed the mutex only for simplicity.

The signal is triggerd immediately after the end of threadfunc if and only if

  • test.exe is called with input redirection and
  • there is at least one output to cerr in the thread (cout works!).

With gcc 3.2.2 the above program works as expected even with pipe input.

Marcel

Change History (2)

comment:1 by anonymous, 18 years ago

Resolution: duplicate
Status: newclosed

same as #109

comment:2 by bird, 18 years ago

Component: libc-frontendlibc
Milestone: kNIX Phase 1
Version: 0.6
Note: See TracTickets for help on using tickets.