From: Yukihiro Matsumoto Date: 2008-10-07T08:14:30+09:00 Subject: Re: Ruby lacks atfork : The evil that lives in fork... Hi, In message "Re: Ruby lacks atfork : The evil that lives in fork..." on Mon, 6 Oct 2008 13:32:30 +0900, John Carter writes: |state(m) is merely reporting the value of $state and the whether the |mutex was locked or not. | |For the time $state is "Inconsistent", the mutex should be in a locked |state. Which it is, when view by any other thread _in the same |process_. | |However, if you fork a process, the mutex in the child process is in |the unlocked state whilst the resource is still in the inconsistent |state. When you fork off the process, the entire resources are (virtually) copied, so that there's no way to ensure (copied) mutex to share locking status across processes. The basic rule is: don't mix threads (and thread related resources like mutex) with processes. matz.