Csaba Henk <csaba / phony_for_avoiding_spam.org> writes:

> Is "$a ||= 1" thread safe? I'd guess so, as "||=" is one piece of

It is not guaranteed to be thread-safe, although in current official
ruby vm it is 'atomic'.

> Is it just an accident, or we can know somehow that this code is thread
> safe? Where do the limits of thread safety lie?

Treat it as an accident and don't depend on this behaviour. You should
synchronise access to shared resources.

> Csaba

Yours,

YS.