File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,17 @@ class Fiber < Object
101101 #
102102 def self.[]= : [A] (Symbol, A) -> A
103103
104+ # <!--
105+ # rdoc-file=cont.c
106+ # - Fiber.blocking{|fiber| ...} -> result
107+ # -->
108+ # Forces the fiber to be blocking for the duration of the block. Returns the
109+ # result of the block.
110+ #
111+ # See the "Non-blocking fibers" section in class docs for details.
112+ #
113+ def self.blocking : [T] () { (Fiber) -> T } -> T
114+
104115 # <!--
105116 # rdoc-file=cont.c
106117 # - Fiber.blocking? -> false or 1
Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ def test_aref
1717 )
1818 end
1919
20+ def test_blocking
21+ if_ruby ( "3.2" ...) do
22+ assert_send_type "() { (Fiber) -> 42 } -> 42" ,
23+ Fiber , :blocking do 42 end
24+ end
25+ end
26+
2027 def test_blocking?
2128 assert_send_type "() -> 1" ,
2229 Fiber , :blocking?
You can’t perform that action at this time.
0 commit comments