From: Eric Wong Date: 2014-09-16T01:01:02+00:00 Subject: [ruby-core:65051] Re: [ruby-trunk - Bug #10231] Process.detach(pid) defines new singleton classes every call headius@headius.com wrote: > FWIW, JVM always does a waiter thread to avoid multiple calls to > waitpid (which as you know returns results exactly once). The waiter > thread is not unusual in that regard. Right. The problem I want to solve is when independently-maintained pieces of code have conflicting calls to waitpid: th = Thread.new { Process.waitpid(-1) } p Process.waitpid(fork {}) p th.value The above behaves inconsistently depending on scheduling. Presumably the thread waiting on a single pid should beat the thread waiting on all threads. And it may not be solvable for waiting on process groups... So the above combination of waitpid calls is likely broken no matter what.