> I’m not sure I understand your proposal.
> 
> But looking more at the code I need to port, an interpreter, I think
> the main issue is that the interpreter relies on sigvtalarm as
> a way to preempt the interpreted program while allowing
> the user program to use only sigalarm. So more generally
> the problem is how can I have two alarms in plan9? I see only
> one alarm signal in ape, SIGALRM. There is no SIGVTALRM.

the standard way to do this is as the kernel does.  the kernel typically
keeps one highres timer (per core), and a linked list of events sorted by alarm
time.  when the alarm fires, do the action associated with each alarm that has
passed and reload periodic timers.  this is in port/portclock.c.  i'm sure there
are implementations of this algorithm elsewhere, too.

- erik

Reply via email to