Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Timeout

Reply
Thread Tools

Timeout

 
 
eastcoastcoder@gmail.com
Guest
Posts: n/a
 
      02-07-2006
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).

 
Reply With Quote
 
 
 
 
Eric Hodel
Guest
Posts: n/a
 
      02-07-2006
On Feb 6, 2006, at 11:18 PM, http://www.velocityreviews.com/forums/(E-Mail Removed) 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 - (E-Mail Removed) - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com




 
Reply With Quote
 
 
 
 
eastcoastcoder@gmail.com
Guest
Posts: n/a
 
      02-07-2006
Thanks for the help.

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timeout::timeout and Socket timeout Mark Probert Ruby 1 10-06-2004 09:30 AM
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Guoqi Zheng ASP .Net 4 06-03-2004 06:39 PM
Session contents lost despite Session.Timeout = 3000; and <sessionState mode="InProc" cookieless="false" timeout="300"> Carpe Diem ASP .Net 3 02-23-2004 07:10 PM
web.config session timeout and forms authentication timeout Do ASP .Net 2 11-23-2003 02:27 PM
Re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Bob Johnson ASP .Net 0 08-07-2003 12:52 PM



Advertisments