in reply to tty for each perl threads
Personally, I'd suggest not doing this. As soon as you start tracing/logging each thread to a different console, you loose sight of any ordering. Better to trace to a single console, serialise the access to that console and prefix your messages with the thread id.
my $semErr :shared; sub twarn { lock $semErr; my $tid = thread->tid; warn sprintf("[%3d]", $tid), @_; } ... twarn "Something happened\n";
You can then filter stderr to concentrate on individual threads.
|
|---|