Ara.T.Howard / noaa.gov wrote:
> On Tue, 10 May 2005, Glenn Parker wrote:
>>
>> Not very thread-safe, at least not in your example's implementation.
> 
> even this is not:
> 
>   class C
>     attr_accessor :x
>   end

Yes, if instances of class C are to be accessed from multiple threads, 
then some extra care is needed, but that depends very much on the actual 
uses of the class.  A lot of classes never need to worry about it, even 
in highly threaded applications.

In the OP's code, it's clear that all threads using class Text will be 
in contention for Text.color.  In that style of interface, a per-thread 
variable is practically mandatory.

-- 
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>