On 2005-02-27, ES <ruby-ml / magical-cat.org> wrote:
> On Sun, February 27, 2005 10:44 am, Csaba Henk said:
> Just answering to this point: there's a trick called the double-checked
> locking pattern that avoids the unnecessary lock. I'm not sure if it helps
> any in your situation:
>
> @@mutex.synchronize {@a ||= [] unless @a} unless @a
>
>>   @@mutex.synchronize { @a ||= [] } unless @a
>>   @a << foo

Thanks!

If you see my solution (which is already in your mail as a quote, just
in the line after the one proposed by you), it's almost the same, just
there is no "unless" in the scope of the mutex. So I kinda figured out
that this is the way to go... Is there any use of that inner "unless"?
I'd guess no...

Regards,
Csaba