forked from ocaml-multicore/eio
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add `Run_in_systhread` effect. This makes the thread-pool part of the scheduler's state, avoiding the need for DLS. - Remove `max_standby_systhreads_per_domain`. Suggested by Vesa Karvonen. - Simplify termination. Use one atomic instead of two. - Use the scheduler's timer to drop idle threads. Modified Zzz to allow non-fiber timeouts.
- Loading branch information
Showing
13 changed files
with
227 additions
and
120 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
val run_on_systhread : enqueue:(('a, exn) result -> unit) -> (unit -> 'a) -> unit | ||
(** A pool of systhreads, to avoid the overhead of creating a new thread for each operation. *) | ||
|
||
type t | ||
|
||
val create : sleep_q:Eio_utils.Zzz.t -> t | ||
(** [create ~sleep_q] is a new thread pool. | ||
[sleep_q] is used to register a clean-up task to finish idle threads. *) | ||
|
||
val run : t -> (unit -> 'a) -> 'a | ||
(** [run t fn] runs [fn ()] and then marks [t] as closed, releasing all idle threads. *) | ||
|
||
val submit : | ||
t -> | ||
ctx:Eio.Private.Fiber_context.t -> | ||
enqueue:(('a, exn) result -> unit) -> | ||
(unit -> 'a) -> | ||
unit | ||
(** [submit t ~ctx ~enqueue fn] starts running [fn] in a sys-thread, which uses [enqueue] to return the result. | ||
If [ctx] is already cancelled then the error is passed to [enqueue] immediately. | ||
Systhreads do not respond to cancellation once running. *) | ||
|
||
type _ Effect.t += Run_in_systhread : (unit -> 'a) -> (('a, exn) result * t) Effect.t | ||
val run_in_systhread : ?label:string -> (unit -> 'a) -> 'a |
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
Oops, something went wrong.