fix: in Fut.await, upon failure, use resume

otherwise a fairly vicious bug happens: the await-er is resumed on the
current runner, not its native one, which can cause deadlocks as it
breaks the executors' dependency DAG. When using `resume` there is no
bug since `resume` is designed to always schedule on the correct runner.
This commit is contained in:
Simon Cruanes 2024-04-01 15:26:30 -04:00
parent 0d325741f4
commit ac851a6d81
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -438,7 +438,7 @@ let await (fut : 'a t) : 'a =
resume k (Ok ()) resume k (Ok ())
| Error (exn, bt) -> | Error (exn, bt) ->
(* fail continuation immediately *) (* fail continuation immediately *)
k (Error (exn, bt)))); resume k (Error (exn, bt))));
}; };
(* un-suspended: we should have a result! *) (* un-suspended: we should have a result! *)
get_or_fail_exn fut get_or_fail_exn fut