[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

eastcoastcoder

2/7/2006 7:18:00 AM

Does Ruby's Timeout know about time spent outside of Ruby's
interpreter?

For instance, will it call Timeout in the model of long syscalls (ie,
blocking io which is taking too long).

If not, what is the best way to tell Ruby to abort a syscall after x
seconds. (I couldn't find a way of setting an alarm handler).

2 Answers

Eric Hodel

2/7/2006 7:42:00 AM

0

On Feb 6, 2006, at 11:18 PM, eastcoastcoder@gmail.com wrote:

> Does Ruby's Timeout know about time spent outside of Ruby's
> interpreter?

Did you try it? It is really, really easy, especially with irb.

> For instance, will it call Timeout in the model of long syscalls (ie,
> blocking io which is taking too long).

require 'timeout'
require 'socket'

s = TCPSocket.new 'localhost', 80
Timeout.timeout 5 do s.read end

--
Eric Hodel - drbrain@segment7.net - http://se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...




eastcoastcoder

2/7/2006 9:08:00 AM

0

Thanks for the help.

For anyone who's reading this's reference, the answer is that Timeout
does timeout in the middle of syscalls.