From: "Xavier Noƫlle" Date: 2010-12-16T20:32:21+09:00 Subject: Re: Behaviour of Thread#stop? 2010/12/14 Brian Candler : > You probably don't want to be doing this. There are higher-level data > structures which will more likely do what you want. > > For example, look at the Queue class. Your worker(s) can pop a message > from the queue as its instructions to work. It works happily with > multiple workers popping from the same queue, as they'll take it in > turns to pop. You're absolutely right. I forgot about the Queue structure, which is perfect for my needs ! > Also, I saw a simple Semaphore class posted a long time ago, which isn't > in the standard library, but you can just copy-paste it. I'll take a look at that. It would be nice if it was in the standard library ! @Su Zhang: I tried with a dummy loop (in fact, there is no code between the mutex release and Thread.stop(), so I needed to cheat) and #stop? returns false even when not sleeping. What do you mean by "blocked outside by the GIL" (I know what the GIL is, but don't understand what kind of problem you're talking about in this sentence). -- Xavier NOELLE