Subject: | Timeout isn't honored in a program with threads |
I'm using Net::Telnet inside a threaded perl program. Because of a bug in SIGALRM handling
in perl, I need to define a global signal handler for SIGALRM otherwise perl bombs when
telnet times out. See http://rt.perl.org/rt3/Public/Bug/Display.html?id=16807.
So, if I don't set that global handler, when Net::Telnet times out, the program crashes. If I set
a local signal handler it crashes too.
If I set a global handler that does nothing, I can't know which thread hang so I can't recover
gracefully. The thread running the Net::Telnet will eventually resume after a couple of
minutes (like if I set Timeout to undef).
I was wondering: Can't you use a timeout in the network system call instead of using
alarm()? That would resolve my problem.
Environment:
perl v5.8.8
Linux 2.6.x