Problems? Is your data what you think it is? | |
PerlMonks |
Locked threads and tcp timeoutsby menth0l (Monk) |
on Feb 16, 2012 at 12:04 UTC ( [id://954207]=perlquestion: print w/replies, xml ) | Need Help?? |
menth0l has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to timeout a print/read operations on tcp socket on ActiveState Perl 5.12?
In above example i would like to wait max 3 seconds for a message and then close this connection. I found that these solutions don't work: 1. Timeout option in socket constructor is related to connect/accept calls so it's useless for me 2. trick with eval/$SIG{ALRM}/alarm() don't work on ActiveState Perl (AFAIK ALRM signal is not supported) Is there any other way? This brings me to another question, threads-related. Let's assume that my thread is performing a "blocking" operation like: executing a SQL procedure, reading from socket (as in above example) or is locked at a semaphore. How can i break execution of that thread? Sending signals won't work since they are processed only after the blocking operation is completed. Is that even possible?
Back to
Seekers of Perl Wisdom
|
|