package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dadde8cfa62be9dabd805fc190b415427b4699ffe3458c153e2f3f9cc5c9b9b4
md5=f96ac96fb0182f2b97dbe9ded452544b
doc/b0.b00/B00/Exec/index.html
Module B00.Exec
Build operation executors.
An executor is a parallel asynchronous work queue. It has no notion of synchronisation, any scheduled operation is randomly executed in parallel up to the executor's parallelizing limits.
Executors
The type for executor feedbacks.
val pp_feedback : feedback B0_std.Fmt.t
pp_feedback
formats executor feedback.
val create :
?clock:B0_std.Time.counter ->
?rand:Random.State.t ->
?tmp_dir:B0_std.Fpath.t ->
?feedback:(feedback -> unit) ->
max_spawn:int ->
unit ->
t
create ~clock ~rand ~tmp_dir ~notify_submit ~max_spawn
with:
max_spawn
the maximal number of processes spawn simultaneously.feedback
called with each scheduled operation when it gets submitted for execution. Default is a nop.tmp_dir
is a directory for temporary files, it must exist; defaults toB0_std.Os.Dir.default_tmp
()
.rand
random state used for internal queues; defaults toRandom.State.make_self_init
.clock
, the clock used to timestamp the operations; defaults toB0_std.Time.counter
()
.
schedule e o
schedules o
for execution in e
. Just before o
is actually submitted for execution it is given to the notify_submit
callback of e
(see create
).
collect e ~block
removes from e
an operation that has completed (if any). If block
is false
and no completed operation exists, the call returns immediately with None
. If block
is true
and at least one incomplete operation exists in e
, the call blocks until an operation completes. If block
is true
and no operation exists in e
None
is returned.