diff --git a/Dispatcher.st b/Dispatcher.st index fcd79ee..d6121fb 100644 --- a/Dispatcher.st +++ b/Dispatcher.st @@ -28,13 +28,24 @@ Object subclass: Dispatcher [ Dispatcher class >> new [ - ^ super new - initialize; + ^super new addToBeFinalized; + startDispatching; yourself ] - initialize [ + Dispatcher class >> install [ + + | dispatcher | + dispatcher := Smalltalk at: #OsmoDispatcher ifAbsentPut: [self new]. + ^dispatcher class = self + ifTrue: [dispatcher] + ifFalse: [ + dispatcher terminate. + Smalltalk at: #OsmoDispatcher put: self new] + ] + + startDispatching [ quit := false. queue := SharedQueue new. @@ -66,6 +77,11 @@ Object subclass: Dispatcher [ sem wait. ] + + terminate [ + + dispatch terminate + ] ] Eval [