package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.b00/B000/Exec/index.html
Module B000.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. Indicates the given operation starts executig with, for spawn operations, their operating system process identifier.
val create :
?clock:B0_std.Os.Mtime.counter ->
?rand:Random.State.t ->
?tmp_dir:B0_std.Fpath.t ->
?feedback:(feedback -> unit) ->
trash:Trash.t ->
jobs:int ->
unit ->
tcreate ~clock ~rand ~tmp_dir ~feedback ~trash ~jobs with:
clock, the clock used to timestamp build operations; defaults toB0_std.Os.Mtime.counter().randrandom state used for internal queues; defaults toRandom.State.make_self_init.tmp_diris a directory for temporary files, it must exist; defaults toB0_std.Os.Dir.default_tmp().feedbacka function called with each scheduled operation when it starts executing. Default is a nop.trash, the trash used to executeB000.Op.Deletebuild operations.jobsthe maximal number of processes spawn simultaneously.
val clock : t -> B0_std.Os.Mtime.counterclock e is e's clock.
val tmp_dir : t -> B0_std.Fpath.ttmp_dir e is e's temporary directory.
val jobs : t -> intjobs e is e's maximal number of simultaneous process spawns.
Scheduling and collecting operations
schedule e o schedules o for execution in e. When o starts executing it is given to the feedback 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.