Multiple processes using #nextPutAll:

Lukas Renggli renggli at gmail.com
Sat May 26 14:51:56 UTC 2007


> > > Thank you for this comments. That was what I was afraid of. Is it
> > > possible to have test that will show #nextPutAll: is not protected?
> >
> > Maybe with the code simulation you can enforce that there are
> > task-switches inbetween.
>
> What is that?

    c1 := writingBlock asContext reentrant.
    c2 := writingBlock asContext reentrant.
    c3 := writingBlock asContext reentrant.

    100 timesRepeat: [ c1 := c1 step ].
    200 timesRepeat: [ c2 := c2 step ].
    300 timesRepeat: [ c3 := c3 step ].

Now you have 3 block contexts c1, c2 and c3 that are each suspended
inside the execution of #nextPutAll:. Think of having clicked in the
debugger 100, 200 and 300 times on the button step. You can inspect
these contexts by opening a dedicated inspector:

    (Debugger context: c1) openFullNoSuspendLabel: ''

Note: #step is a bit buggy in certain cases, so take care ;-)

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list