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

Igor Stasenko siguctua at gmail.com
Tue Oct 12 10:14:04 EDT 2010


On 12 October 2010 17:07, Lukas Renggli <renggli at gmail.com> wrote:
>> 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?
>

This is a bit blurry. I remember Eliot said it is no longer true under Cog VM.


> Lukas
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list