File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ let any_gen ~return ~combine fs =
150150 )
151151 in
152152 match ! r, Cancel. get_error parent_c with
153- | OK r , None -> r
154- | ( OK _ | New ) , Some ex -> raise ex
153+ | OK r , _ -> r
154+ | New , Some ex -> raise ex
155155 | Ex (ex , bt ), None -> Printexc. raise_with_backtrace ex bt
156156 | Ex ex1 , Some ex2 ->
157157 let bt2 = Printexc. get_raw_backtrace () in
Original file line number Diff line number Diff line change @@ -191,21 +191,23 @@ Cancelled from parent:
191191Exception: Failure "Parent cancel".
192192```
193193
194- Cancelled from parent while already cancelling:
194+ Cancelled from parent while already cancelling
195+ (we return the value despite the cancellation):
195196
196197``` ocaml
197198# run @@ fun () ->
198199 Fiber.both
199200 (fun () ->
200- let _ = Fiber.first
201+ traceln "%s" @@ Fiber.first
201202 (fun () -> "a")
202- (fun () -> Fiber.yield (); failwith "cancel-b")
203- in
203+ (fun () -> Fiber.yield (); failwith "cancel-b");
204+ Fiber.check ();
204205 traceln "Parent cancel failed"
205206 )
206207 (fun () -> traceln "Cancelling parent"; failwith "Parent cancel");
207208 "not-reached";;
208209+Cancelling parent
210+ +a
209211Exception: Failure "Parent cancel".
210212```
211213
You can’t perform that action at this time.
0 commit comments