[前][次][番号順一覧][スレッド一覧]

ruby-changes:70402

From: Samuel <ko1@a...>
Date: Tue, 21 Dec 2021 08:33:08 +0900 (JST)
Subject: [ruby-changes:70402] 711342d935 (master): Update cont.c

https://git.ruby-lang.org/ruby.git/commit/?id=711342d935

From 711342d93565092a8348ac5538bc4b4288d384ba Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Tue, 21 Dec 2021 12:30:17 +1300
Subject: Update cont.c

---
 cont.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/cont.c b/cont.c
index abbfac52160..ab06e6969af 100644
--- a/cont.c
+++ b/cont.c
@@ -3103,16 +3103,31 @@ rb_fiber_scheduler_interface_address_resolve(VALUE self) https://github.com/ruby/ruby/blob/trunk/cont.c#L3103
 
 /*
  *  Document-method: SchedulerInterface#address_resolve
- *  call-seq: timeout_after(duration, exception_class, *exception_args, &block) -> obj
- *
- *  Invoked by Timeout.timeout to perform execution time control in a non-blocking way.
- *
- *  The method is expected to execute a +block+, and if its execution takes longer
- *  than +duration+, to raise +exception_class+ constructed with +exception_args+.
+ *  call-seq: timeout_after(duration, exception_class, *exception_arguments, &block) -> result of block
+ *
+ *  Limit the execution time of a given +block+ to the given +duration+ if
+ *  possible. When a non-blocking operation causes the +block+'s execution time
+ *  to exceed the specified +duration+, that non-blocking operation should be
+ *  interrupted by raising the specified +exception_class+ constructed with the
+ *  given +exception_arguments+.
+ *
+ *  General execution timeouts are often considered risky. This implementation
+ *  will only interrupt non-blocking operations. This is by design because it's
+ *  expected that non-blocking operations can fail for a variety of
+ *  unpredictable reasons, so applications should already be robust in handling
+ *  these conditions.
+ *
+ *  However, as a result of this design, if the +block+ does not invoke any
+ *  non-blocking operations, it will be impossible to interrupt it. If you
+ *  desire to provide predictable points for timeouts, consider adding
+ *  +sleep(0)+.
+ *
+ *  This hook is invoked by Timeout.timeout and can also be invoked directly by
+ *  the scheduler.
  *
- *  If the block is executed successfully, its result should be returned.
+ *  If the block is executed successfully, its result will be returned.
  *
- *  The method support should be considered _experimental_.
+ *  The exception will typically be raised using Fiber#raise.
  */
 static VALUE
 rb_fiber_scheduler_interface_timeout_after(VALUE self)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]