ocaml-multicore / domainslib

Parallel Programming over Domains
ISC License
171 stars 30 forks source link

Provide a way to iterate over all the pools #46

Open kayceesrk opened 3 years ago

kayceesrk commented 3 years ago

It will be useful to have a way to iterate over all the pools that are created in domainslib. One use case is to teardown all the pools. But there may be others (stats?). See relevant discussion at https://github.com/ocaml-multicore/domainslib/pull/45#issuecomment-930224410.

The data structure to use for this would be the Weak hash set https://ocaml.org/api/Weak.html#1_Weakhashsets, which will hold a weak pointer to the pools.