fix: make Fiber.check_if_cancelled fail if the fiber is not done

This commit is contained in:
Simon Cruanes 2024-03-14 23:46:44 -04:00
parent 9a26914c9f
commit 4c909703c0
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -295,7 +295,13 @@ let with_on_self_cancel cb (k : unit -> 'a) : 'a =
module Suspend_ = Moonpool.Private.Suspend_ module Suspend_ = Moonpool.Private.Suspend_
let[@inline] check_if_cancelled_ (self : _ t) = Fut.raise_if_failed self.res let check_if_cancelled_ (self : _ t) =
match A.get self.state with
| Terminating_or_done r ->
(match A.get r with
| Error ebt -> Exn_bt.raise ebt
| _ -> ())
| _ -> ()
let check_if_cancelled () = let check_if_cancelled () =
match Task_local_storage.get k_current_fiber with match Task_local_storage.get k_current_fiber with