Clifford Heath
2/2/2008 11:35:00 PM
Marcin Raczkowski wrote:
> Magician White wrote:
>> Is one class extended to the Thread class and whith one specific
>> operation.
> Why would you do that?
> first of all, reember to call super if you do initialization, second why
> don't you just provide Thread.new with block?
There might be good reasons to do that. I often subclass Thread to
give each thread an API for status and interchange, other than just
shared variables. That way you can include the required synchronization
inside the API.
That said, does the OP know that Ruby's "green threads" will only ever
schedule one thread at a time? Even on a multi-core/multi-CPU box?
If each thread completes within its timeslice, it will appear that
they're running sequentially.
Clifford Heath.