package moonpool
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=2c10792726b1c2e4987f0f2acca5c5c221ea5cc0a2b4c75ad4fd2709e32aab6f
sha512=801c399ae9b72dd5f84624cdee9bcbb56c5ed9c371001e00176e685686234b4135d69e48877412b25a5127ad59b729000d5422dad0c90e2ded2744b974dddeca
doc/moonpool.dpool/Moonpool_dpool/index.html
Module Moonpool_dpool
Source
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.
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 thread must call decr_on
with i
once it's done.
Signal that a thread is stopping on the domain with index i
.
run_on_and_wait i f
runs f()
on the domain with index i
, and blocks until the result of f()
is returned back.