On 6 December 2012 16:12, Igor Stasenko <siguctua@gmail.com> wrote:
this is not a bug, but limitation. delay object(s) are not reentrant: means that you shall not use same delay instance multiple times, i.e.
delay := 1 seconds asDelay. 10 timesRepeat: [ [ delay wait ] fork ].
instead you shall create a fresh instance for each "delay" intent:
10 timesRepeat: [ [ 1 seconds asDelay wait ] fork ].
if Delay could implement #copy, then you could write like: delay := 1 seconds asDelay. 10 timesRepeat: [ [ delay copy wait ] fork ]. this is because a Delay has 1:1 correspondence with its semaphore object. and when you scheduling it multiple times, it will end up using same semaphore for all instances of it... and that's why you get weird behavior. -- Best regards, Igor Stasenko.