"Xavier Nolle" <xavier.noelle / gmail.com> wrote in post #968343:
> I'm currently struggling with Ruby threads, especially the #stop and
> #stop? methods.

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.

Look also at ConditionVariable.

Note you need to require 'thread' for both Queue and ConditionVariable.

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.