ocaml-multicore icon indicating copy to clipboard operation
ocaml-multicore copied to clipboard

Destroy channel mutexes after fork

Open abbysmal opened this issue 4 years ago • 1 comments

We do not reset the channel mutexes after fork right now. For example, systhreads does it here in trunk: https://github.com/ocaml/ocaml/blob/trunk/otherlibs/systhreads/st_stubs.c#L419-L427

abbysmal avatar Jul 08 '21 08:07 abbysmal

There is also the bigger question of what, if anything, should be done regarding other mutexes in the runtime system introduced by Multicore OCaml. Given that Multicore OCaml will (should?) raise an exception on a call to fork if a domain was spawned in the past, the invariants are simpler. No mutexes in the runtime are held or waiting to be locked by another thread (except by systhreads, which are already being handled by stock OCaml). In theory, there should be no need to reinitialise the mutexes in the runtime.

kayceesrk avatar Jul 08 '21 08:07 kayceesrk