Hi Norbert, I couldn't have said it any better. For me, this also was interesting, because I first thought: "Heck, how would I make anything atomic anyways?". And that question still stands: is there a way to make something atomic that includes message sends? I guess #critical is not the solution, is it? Joachim Am 14.11.13 11:12, schrieb Norbert Hartl:
Am 14.11.2013 um 10:25 schrieb Marcus Denker <marcus.denker@inria.fr>:
On 14 Nov 2013, at 10:15, Stephan Eggermont <stephan@stack.nl> wrote:
Reading this code, made me wonder what operations are actually atomic. Anyone having a good explanation?
Stephan
AtomicQueueItem>makeCircular "Make a receiver circular, i.e. point to itself, answer the old value of next variable. Note, this operation should be atomic"
| temp |
" atomic swap here" temp := next. next := self.
^ temp
-> no message send -> no back jump bytecode
therefore it can not be interrupted and process switches can not happen between the statements. Thanks, I learn something new every day. Iâve never thought about the condition when a process switch can happen. Can you say in short when a switch of processes is checked? Because I think I wonât finding it in a reasonable time looking myself.
Norbert
-- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1