file: 01-C-event.t package: muf status: alpha
This function is invoked by the ]signal
primitive to do the work of actually generating a list
of all active handlers, then sequentially invokes each
handler appropriate to the given event, most recent
binding first, until one doesn't return. If all
return, ]doSignal returns nothing.
The in-server signal[ operator itself
merely handles the necessary magic to pass the
event block between jobs, if needed, then
invokes the in-db ]doSignal function to do
the rest of the work.
Customization of ]doSignal is possible:
]signal actually runs whatever function it
finds in the @$s.doSignal property of the
recipient job. You may set this property to
anything you like. If it is not set to a valid
compiledFunction object, ]signal
will silently ignore all events raised.
The ]doSignal function is currently implemented as:
: ]doSignal
( This function is the default value of )
( @$s.doSignal, and hence gets called by )
( the server when delivering a signal to )
( the job. )
:event |get -> event
|getAllActiveHandlers[
-> k
-> hi
-> lo
for i from lo below hi do{
i dupBth -> eventN
i k + dupBth -> handlerN
.err.event event = if
handlerN ]invokeHandler
else
event eventN childOf? if
handlerN ]invokeHandler
fi fi
}
]pop
]pop
;
(The special .err.event event = if hack
is partial enforcement of the CommonLisp requirement that
all events inherit from .err.event: This
hack at least guarantees that a handler set on
.err.event will catch all signals.)
Go to the first, previous, next, last section, table of contents.