Signal() emulation

From: Ronald Oussoren <roussor_at_nospam.org>
Date: Wed Apr 05 1995 - 06:08:00 PDT

I found an old (?,1988) version of the POSIX standard in the
local library, and I'm now trying to implement the signal
functions of POSIX for VSTa, by extending the existing code
for signal() (which uses events). Most of it seems to be not
to hard. Two two more problematic functions seem to be
sigsuspend() (and therefore pause(), the ANSI C equivalent),
and alarm().

Sigsuspend() is used to wait for a signal. Currently I
have implemented this using busy waiting. Is there a
system call to wait for the delivery of an event, and
if not, is there a reason for not having it?

The other problem is alarm(). Alarm() should make provisions
for the (async) generation of a SIGALRM signal after a number
of seconds. This part is easy: just fork of a thread that
sleeps that number of seconds and then sends the event.
However, calling alarm() should also cancel the outstanding
timer, and return the number of seconds until the canceled
timer would cause a signal. How can this be done from
user space?

While I am asking questions, why doesn't tfork() allow
passing a parameter to the new thread? Wouldn't having
this ability make it easier to create thread-safe code
(no need for a global variable to pass data to the new
thread, like in the implementation of rename()).

        Ronald
Received on Wed Apr 5 05:21:35 1995

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:27 PDT