From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Description of problem: When a parent process starts up several child processes that share the same standard output stream, the output to cout is mangled in the output file. Some of the child tasks are multithreaded, and the calls to cout are contained with in a flockfile( stdout ) and funlockfile( stout ) calls. Output from multiple threads in the same task is correct; it is just output from the several child processes that are mangled. I have created a test program that exposes the problem. Ten child process are forked that each output the same line of text repeatedly. All processes are single threaded in the test case. The test case output is correct on g++ 2.96, or 2.95. The output is not mangled on gcc 3 if the cout output operators are replaced with printf calls. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. make 2. ./parent 3. Actual Results: 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one' 'This is the first one'Seive eT' 'I am ven comes next' ' 'This is the first one' 'This is the first one' 'This is h'The third process' 'The third process six' 'I guei' am number four' 'The third process' is the nethe second' Expected Results: 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'Five is the next one' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' 'I guess this should be six' Additional info: RPMS: gcc3-3.0.4-1 gcc3-c++-3.0.4-1 libgcc-3.0.4-1 libstdc++3-devel-3.0.4-1 libstdc++3-3.0.4-1 glibc-2.2.4-24
Created attachment 55366 [details] Attachment of test case that exposes the problem
flockfile is internal to a threaded app only