Moonpool_dpool
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.
type domain = Moonpool_private.Domain_.t
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.