From: "Kirk Haines" <khaines / enigo.com>
>
> On Thursday 10 November 2005 10:42 am, jwesley wrote:
> 
>> 1) An exception is stored in a global variable, "$!". If multiple
>> threads have exceptions thrown, is the the thread guaranteed to get
>> it's own exception (not another threads) when evaluating the "$!".  (I
>> know there is a work around by naming the exception.)
>>
>> 2) Does ruby commonly use global values to pass values...which is not
>> thread safe (unless it's somehow "thread-local").
> 
> Don't use globals.  I can't think of a single instance where one needs to use 
> them, though maybe someone else can.  So, if you do want to use them, use a 
> mutex.synchronize block around them.

But, yes, variables like $&, $`, $', $1..$n and I've no doubt $! are
really thread-local.


Regards,

Bill