From: Charles Oliver Nutter Date: 2008-01-01T05:59:22+09:00 Subject: Re: deadlock in ThreadPool using backtick ara.t.howard wrote: > > On Aug 8, 2007, at 11:11 AM, Justin Johnson wrote: > >> Does anyone know what the problem is? > > my mind is much too feeble to write robust threaded code that's safe on > all platforms. invert your process flow and it's easy: this works on > *nix and winblows -> ... > by spooling up all the thread at once you'll save the overhead of > creating all those threads. the @q.pop stuff does all the condition > variable stuff you were trying to do so you can check that code out if > you want to. Isn't this largely just working around a lack of concurrency in Ruby's threading model (or perhaps a bug in backtick handling)? With concurrent threads I can implement the same thing in a trivial amount of code and not have to worry about backticks et al blocking, nor about spinning up processes. In fact with native threads the original ThreadPool from Ruby Cookbook ought to work fine for basically anything you want to throw at it (including backticks). Perhaps backtick needs to be fixed in MRI so it doesn't block the entire runtime? - Charlie