-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eio_linux: allow alloc_fixed_or_wait to be cancelled
- Loading branch information
Showing
7 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(** Allows a single fiber to wait to be notified by another fiber in the same domain. | ||
If multiple fibers need to wait at once, or the notification comes from another domain, | ||
this can't be used. *) | ||
|
||
type 'a t | ||
(** A handle representing a fiber that might be sleeping. | ||
It is either in the Running or Sleeping state. *) | ||
|
||
val create : unit -> 'a t | ||
(** [create ()] is a new waiter, initially in the Running state. *) | ||
|
||
val wake : 'a t -> ('a, exn) result -> bool | ||
(** [wake t v] resumes [t]'s fiber with value [v] and returns [true] if it was sleeping. | ||
If [t] is Running then this just returns [false]. *) | ||
|
||
val wake_if_sleeping : unit t -> unit | ||
(** [wake_if_sleeping] is [ignore (wake t (Ok ()))]. *) | ||
|
||
val await : 'a t -> string -> Trace.id -> 'a | ||
(** [await t op id] suspends the calling fiber, changing [t]'s state to Sleeping. | ||
If the fiber is cancelled, a cancel exception is raised. | ||
[op] and [id] are used for tracing. *) | ||
|
||
val await_protect : 'a t -> string -> Trace.id -> 'a | ||
(** [await_protect] is like {!await}, but the sleep cannot be cancelled. *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters