[mercury-users] signal handling (was: Native garbage collector)
Thomas Charles CONWAY
conway at cs.mu.OZ.AU
Mon Sep 14 16:26:13 AEST 1998
Fergus Henderson, you write:
> However, if you change it to take two `pred' arguments, one being the
> handler, and the other being the goal over which the handler is scoped,
>
> :- type io_pred == pred(io__state, io__state).
> :- type io_mode == pred(di, uo) is det.
>
> :- pred handler(signal, io_pred, io_pred, io__state, io__state).
> :- mode handler(in, io_mode, io_mode, di, uo) is det.
>
> % handler(Signal, HandlerCode, NormalCode)
>
> then you can give it a proper declarative semantics.
>
> Basically signal handlers are a form of concurrency. You can think
> of the `handler' predicate above as establishing a new thread which
> remains blocked until a signal arrives.
> The difference between the two predicates handler/4 and handler/5 above
> is like the difference between the fork/3 and fork/4 predicates that we
> have discussed.
>
Slight bug:
:- pred handler(signal, io_pred, io_pred, io__state, io__state).
:- mode handler(in, io_mode, io_mode, di, uo) is cc_multi.
^^^^^^^^
Thomas
--
Thomas Conway <conway at cs.mu.oz.au>
Nail here [] for new monitor. )O+
More information about the users
mailing list