dispatcher: Merge code from Norbert to allow to install alternative dispatchers
Norbert introduced the MockDispatcher to get nice and direct exceptions.
This commit is contained in:
parent
f2be904848
commit
c5f53b7d64
|
@ -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 [
|
||||
|
|
Reference in New Issue