···150150 )
151151 in
152152 match !r, Cancel.get_error parent_c with
153153- | OK r, None -> r
154154- | (OK _ | New), Some ex -> raise ex
153153+ | OK r, _ -> r
154154+ | 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
+6-4
tests/fiber.md
···191191Exception: Failure "Parent cancel".
192192```
193193194194-Cancelled from parent while already cancelling:
194194+Cancelled from parent while already cancelling
195195+(we return the value despite the cancellation):
195196196197```ocaml
197198# run @@ fun () ->
198199 Fiber.both
199200 (fun () ->
200200- let _ = Fiber.first
201201+ traceln "%s" @@ Fiber.first
201202 (fun () -> "a")
202202- (fun () -> Fiber.yield (); failwith "cancel-b")
203203- in
203203+ (fun () -> Fiber.yield (); failwith "cancel-b");
204204+ Fiber.check ();
204205 traceln "Parent cancel failed"
205206 )
206207 (fun () -> traceln "Cancelling parent"; failwith "Parent cancel");
207208 "not-reached";;
208209+Cancelling parent
210210++a
209211Exception: Failure "Parent cancel".
210212```
211213