The standard implementation of fork and mutex are incompatible. A thread
which is alive (but not current) at fork time will be dead in the fork.
That’s fine, but if that thread holds a lock on a mutex, it will never
give up the lock. This will cause the fork to die if its thread tries to
lock the mutex.
Also, there is a race condition in Mutex that can cause a thread to jump
ahead of the queue of waiters, and cause the queue of waiters to be rotated.
There is an example (of the former problem) and an implementation of
mutex and fork which avoid both problems at: