Fix problems with forking.
This manifested on OSX, but was probably broken on other platforms.
The idea is to remove all other (dead) threads from the ring in the child
process, while still releasing their mutexes.