[Pharo-project] [squeak-dev] How about atomic value-swap bytecode?

Lukas Renggli renggli at gmail.com
Tue Oct 12 10:07:08 EDT 2010

> To swap two values, you usually do:
> | var1 var2 temp |
> temp := var1.
> var1 := var2.
> var2 := temp.
> But since its non-atomic, a process can be interrupted and such operation
> is not thread-safe.

As far as I know the VM only preempts on back-jumps and message sends.
None of that exists in your code snipped, so it should be atomic. No?


Lukas Renggli

More information about the Pharo-dev mailing list