[Pharo-dev] SHTextStyler>>#styleInBackgroundProcess:

Sven Van Caekenberghe sven at stfx.eu
Tue Nov 19 11:26:34 EST 2013

In many images that I do real development in (code writing, debugging, ..) I always get a number of processes stuck while waiting for a semaphore in SHTextStyler>>#styleInBackgroundProcess:

I am in no way an expert in these areas, but today I tried the following change (waiting on the semaphore with a timeout):

SHTextStyler>>#styleInBackgroundProcess: aText
  self terminateBackgroundStylingProcess.
  stylingEnabled ifTrue: [ 
    text := aText copy.
    self monitor critical: [ 
      sem := Semaphore new.
        sem ifNotNil: [ 
          ((sem waitTimeoutMSecs: 250) not and: [ view notNil ])
            ifTrue: [ view stylerStyledInBackground: text ] ] ] forkAt: Processor activePriority.
      backgroundProcess := [ 
        self privateStyle: text.
        sem signal ] forkAt: Processor userBackgroundPriority ] ]

Comments ?


More information about the Pharo-dev mailing list