package moonpool
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7641327370ece987c09accdd15eb31566931ecdd58d41189080b0b951b8addfc
sha512=65d45c44cda768ba6934ad4d6b9a397651a87b34a143c85fe1108228db861c369d6efc4832adfcac85368c6a861f33816af4d7c3e3d1238eaddfc564c0ea42db
doc/moonpool.dpool/Moonpool_dpool/index.html
Module Moonpool_dpoolSource
Static pool of domains.
These domains are shared between all the pools in moonpool. The rationale is that we should not have more domains than cores, so it's easier to reserve exactly that many domain slots, and run more flexible thread pools on top (each domain being shared by potentially multiple threads from multiple pools).
The pool should not contain actual domains if it's not in use, ie if no runner is presently actively using one or more of the domain slots.
The pool is initialized by the first execution request, which must be made from the main domain. A process using fork must fork before that request.
NOTE: Interface is still experimental.
Number of domains in the pool when all domains are active.
Low level interface for resouce handling
Be very cautious with this interface, or resource leaks might occur.
run_on i f runs f() on the domain with index i. Precondition: 0 <= i < n_domains(). The first call must be made from the main domain. The thread must call decr_on with i once it's done. NOTE: if f() raises, the process will exit with error.
Signal that a thread is stopping on the domain with index i. The pool must already be initialized.