||= happens in Perl code, yet it's not thread safe.
You're still not getting it.
That's the basic tenet of threads. Everything(*) is thread-safe unless it involves explicitly shared variables. Clear and unambiguous.
It is the very raison d'etre of ithreads.
That the basic tenet threads::shared. Again, clear and unambiguous.
There is no purpose in documenting the thread-safety of every opcode--or internal operations--because they are all completely covered by those two simple tenets
And that is what sets iThreads apart, and above, any other shared-state concurrency implementation. You use it exactly as if it was non-threaded, with no shared-state, even for the nasties of interpreted language threading--fat variables & closures. Except where you need shared-state, then you mark it explicitly and take the appropriate precautions.
Sure, the implementation could be more efficient--of time and memory. And the user could be given finer-grained control. But for the most part, inventing a model that allows so many pre-threading modules to just work inside threads is a remarkable achievement. Even the majority of non-Pure Perl modules function perfectly within iThreads, and that's truly remarkable, and no accident.
Artur Bergman should be lauded.
(*)For the pedants: External state excluded.
In reply to Re^4: is ||= threadsafe?
by BrowserUk
in thread is ||= threadsafe?
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |