summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dispatcher.st22
1 files changed, 19 insertions, 3 deletions
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 [
<category: 'private'>
- ^ super new
- initialize;
+ ^super new
addToBeFinalized;
+ startDispatching;
yourself
]
- initialize [
+ Dispatcher class >> install [
+ <category: 'singleton'>
+ | dispatcher |
+ dispatcher := Smalltalk at: #OsmoDispatcher ifAbsentPut: [self new].
+ ^dispatcher class = self
+ ifTrue: [dispatcher]
+ ifFalse: [
+ dispatcher terminate.
+ Smalltalk at: #OsmoDispatcher put: self new]
+ ]
+
+ startDispatching [
<category: 'private'>
quit := false.
queue := SharedQueue new.
@@ -66,6 +77,11 @@ Object subclass: Dispatcher [
sem wait.
]
+
+ terminate [
+ <category: 'private'>
+ dispatch terminate
+ ]
]
Eval [