[mercury-users] Native garbage collector for Mercury

Peter Schachte pets at cs.mu.OZ.AU
Mon Sep 14 11:35:32 AEST 1998


On Mon, Sep 14, 1998 at 09:56:30AM +1000, Thomas Charles CONWAY wrote:

> One easy way of dealing with interrupts is to provide a way of arranging
> for a closure to be evaluated on a given interrupt:
> 
> :- type signal	== word.
> 
> :- pred handler(signal, pred(io__state, io__state), io__state, io__state).
> :- mode handler(in, pred(di, uo) is det, di, uo) is det.

But how do you steal the io__state from the predicate that's running
when the interrupt happens, and put it back when the interrupt closure
completes?

This isn't a frivolous question.  For example, you might want to have
some code reading from a buffer, and have an interupt handler copy
code from DMA memory into the buffer.  So you *need* to pinch the
io__state from the running code, modify it, and quietly put it back,
so that the running code can read it.  I can't see how to abstract
this process statelessly.

-- 
Peter Schachte                | Apologists for Economic Darwinism seem to
mailto:pets at cs.mu.OZ.AU       | forget that the goal is maximum aggregate
http://www.cs.mu.oz.au/~pets/ | utility -- not just having the fittest
PGP: finger pets at 128.250.37.3 | corporations. -- me 



More information about the users mailing list