D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Fiber
/
Scheduler
/
Filename :
timeout_after-i.ri
back
Copy
U:RDoc::AnyMethod[iI"timeout_after:ETI"#Fiber::Scheduler#timeout_after;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NInvoked by Timeout.timeout to execute the given +block+ within the given ;TI"O+duration+. It can also be invoked directly by the scheduler or user code.;To:RDoc::Markup::BlankLine o; ; [ I"IAttempt to limit the execution time of a given +block+ to the given ;TI"P+duration+ if possible. When a non-blocking operation causes the +block+'s ;TI"Jexecution time to exceed the specified +duration+, that non-blocking ;TI"Poperation should be interrupted by raising the specified +exception_class+ ;TI"6constructed with the given +exception_arguments+.;T@o; ; [ I"PGeneral execution timeouts are often considered risky. This implementation ;TI"Qwill only interrupt non-blocking operations. This is by design because it's ;TI"Eexpected that non-blocking operations can fail for a variety of ;TI"Qunpredictable reasons, so applications should already be robust in handling ;TI"2these conditions and by implication timeouts.;T@o; ; [ I"MHowever, as a result of this design, if the +block+ does not invoke any ;TI"Lnon-blocking operations, it will be impossible to interrupt it. If you ;TI"Hdesire to provide predictable points for timeouts, consider adding ;TI"+sleep(0)+.;T@o; ; [I"HIf the block is executed successfully, its result will be returned.;T@o; ; [I">The exception will typically be raised using Fiber#raise.;T: @fileI"scheduler.c;T:0@omit_headings_from_table_of_contents_below0I"_timeout_after(duration, exception_class, *exception_arguments, &block) -> result of block ;T0[ I"(p1, p2, p3);T@*FI"Scheduler;TcRDoc::NormalClass00