--- Begin Message ---
Hi,

If I create a class HotSwapping with the instance variable currentBLoc (and the 
corresponding accessors) and the following methods :

HotSwapping>>initialize
        currentBloc := [ 1 to:50 do: [:index |Transcript show: index. 100 
milliSeconds asDelay wait]. Transcript cr. 1000 milliSeconds asDelay wait ]

HotSwapping>>run
        [10 timesRepeat: [ currentBloc value ]] fork

I then do : obj := HotSwapping new run
The “funny” thing is that, when Transcript starts showing numbers, lets say : 
12345678910 (i.e. the bloc is in the middle of its execution), I do obj 
currentBloc: [Transcript show: ‘Hello’;cr. 1000 milliSeconds asDelay wait ]

The Transcript does not stop showing numbers. It shows the Hello message only 
after the old bloc has finished executing (the entire line of number form 0 to 
50 has been printed in the Transcript)

So why does not this happen this way? Why the assignment of the new code is 
delayed until the end of the bloc execution? is it something related to threads 
execution or does Pharo implement some safety hot swapping mechanisms?

Thanks in advance.
Abdelghani


--- End Message ---

Reply via email to