[squeak-dev] Re: How about atomic value-swap bytecode?

Lawson English lenglish5 at cox.net
Tue Oct 12 21:41:23 UTC 2010


  On 10/12/10 2:21 PM, Stefan Marr wrote:
> On 12 Oct 2010, at 22:51, Andreas Raab wrote:
>
>> On 10/12/2010 6:14 AM, Igor Stasenko wrote:
>>> Hello, i just thought, that it would be cool to have a special bytecode,
>>> which guarantees atomicity for swapping values between two variables.
>>>
>>> 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.
>> Actually, this is thread-safe. Process switches happen only on sends and backwards branches.
> Please, do not rely on such implementation details, and please do not advocate them.
> You will never know where your code is running on tomorrow...
>
> http://permalink.gmane.org/gmane.comp.lang.smalltalk.squeak.general/152184
>
>

Will this be online also? Will there be videos available during/afterwards?

Thanks.


Lawson




More information about the Squeak-dev mailing list