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 [
|
Dispatcher class >> new [
|
||||||
<category: 'private'>
|
<category: 'private'>
|
||||||
^ super new
|
^super new
|
||||||
initialize;
|
|
||||||
addToBeFinalized;
|
addToBeFinalized;
|
||||||
|
startDispatching;
|
||||||
yourself
|
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'>
|
<category: 'private'>
|
||||||
quit := false.
|
quit := false.
|
||||||
queue := SharedQueue new.
|
queue := SharedQueue new.
|
||||||
|
@ -66,6 +77,11 @@ Object subclass: Dispatcher [
|
||||||
|
|
||||||
sem wait.
|
sem wait.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
terminate [
|
||||||
|
<category: 'private'>
|
||||||
|
dispatch terminate
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
Eval [
|
Eval [
|
||||||
|
|
Reference in New Issue