Posted on 2008-08-29 22:03:27-07 by ssinyagin in response to 8697
Re: reopening STDERR in parent process
thanks, that explains a lot. Actually the child threads are detached, but I'll handle that.

in some archives at perlmonks someone said that file descriptors are global across all threads, and that's what confused me in my understanding of what's going on. Also it looks like when the thread is created, it does not inherit the value of $| - the messages written by the child thread are sometimes cut by the buffering.
I think the most reliable thing would be instead of printing to STDERR in the child thread, push the error messages into a queue and let the main thread pop the messages and print them to the main thread's STDERR.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.