in reply to perl file handle share thread
What makes you think you need to do anything special?
The following starts a thread logging to STDERR (which is redirected to 'oldLog') once per second. The main thread then sleeps, logs once, reopens STDERR to 'aNewLog'; logs once more then sleeps 3 before ending. You'll see that there is output from both threads in 'oldLog', and also from both in 'aNewLog':
C> perl -Mthreads -E" async{ warn threads->tid while sleep 1}; sleep 1; warn threads->tid; open STDERR, '>', 'aNewLog'; warn threads->tid; sleep 3 " 2>oldLog C> type oldLog 1 at -e line 1. 0 at -e line 1. C> type aNewLog 0 at -e line 1. 1 at -e line 1. 1 at -e line 1. 1 at -e line 1. Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl file handle share thread
by Anonymous Monk on May 20, 2010 at 21:59 UTC | |
by BrowserUk (Patriarch) on May 20, 2010 at 23:19 UTC |