Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!math.fu-berlin.de!opal!unido!laura!julien!huba From: huba@ls5.informatik.uni-dortmund.de (Hubert Baumeister) Newsgroups: comp.lang.smalltalk Subject: Re: anyone using time-sliced scheduling w/st80? Message-ID: <3109@laura.UUCP> Date: 19 Mar 91 13:36:27 GMT References: <4861@ns-mx.uiowa.edu> <3095@laura.UUCP> <15113@dutrun.UUCP> Sender: news@laura.UUCP Reply-To: huba@ls5.informatik.uni-dortmund.de (Hubert Baumeister) Organization: University of Dortmund, Germany Lines: 39 In article <15113@dutrun.UUCP>, winfwrd@dutrun.UUCP (Paul van der Weerd) writes: ... |> To prevent unprotected simultaneous access to a single Transcript, I took the |> following approach: |> ( |> | p1 p2 t1 t2 | |> "Define some textcollectors." |> [t1 := TextCollector new. |> TextCollectorView open: t1 label: 'Process 1'] fork. |> [t2 := TextCollector new. |> TextCollectorView open: t2 label: 'Process 2'] fork. |> "Define some processess." |> p1 := [[true] whileTrue: [t1 show: 'A']] newProcess. |> p2 := [[true] whileTrue: [t2 show: 'B']] newProcess. |> "Run processes alternately." |> (p1 priority: 3) resume. |> (p2 priority: 3) resume. |> 300 timesRepeat: [ |> (Delay forMilliseconds: 200) wait. |> (Processor suspendFirstAt: 3) resume]. |> p1 terminate. |> p2 terminate. |> ) |> Normally this works, but when some windows are overlapping, |> the system crashes. What is wrong? I suppose you use Smalltalk 80 v2.5 or earlier. These versions assume that when drawing on a window this window is completely visible. To achieve this the TextCollectorViews use the method displaySafe: aBlock in ControlManager. This method tops the window and executes aBlock. When both TextCollectorViews want to display themselves at the same time there is a race condition in displaySafe:. In Smalltalk Release 4.0 this works fine since there it is possible to draw on partly hidden windows and thus it needs no hack like the one described above. Hubert Baumeister (huba@ls5.informatik.uni-dortmund.de)