Transcript is not thread-safe???

jchludzinski at worldkey.net jchludzinski at worldkey.net
Sat Oct 28 04:26:20 UTC 2000


Ned Konz wrote:
  
>The Transcript is not thread-safe, for one thing; for another, you 
>make the UI run every time you send stuff to the Transcript (at 
>least when you do an endEntry).
 
 
It was suggested by someone on this mailing list months ago that I 
add & change TranscriptStream as follows,

1) add AccessSema as a class variable:

   WriteStream subclass: #TranscriptStream
      instanceVariableNames: ''
      classVariableNames: 'AccessSema '
      poolDictionaries: ''
      category: 'Collections-Streams'


2) change #endEntry to:

   endEntry
      self semaphore
         critical: 
            [self changed: #appendEntry.
            self reset]

and
3) add:

   semaphore
      ^ AccessSema
         ifNil: [AccessSema _ Semaphore forMutualExclusion]


This seems to have work (at least for me!).


---John






More information about the Squeak-dev mailing list