On Tue, Jan 29, 2008 at 12:10:11PM -0600, Mark Martin wrote:
> I'd appreciate comments on my fix for bug 6409970.
> 
> The diffs are available at: http://cr.opensolaris.org/~devnull/6409970/
> 
> I have an extremely simple test harness available at:
> http://cr.opensolaris.org/~devnull/6409970/checkstartd.
> Please do not judge me by my lack of script-fu.

I've recently had to write code to handle signals in a daemon (idmapd)
that has an event loop.  I considered using condition variables, but,
looking at the code and manpages I could not convince myself that
pthread_mutex_lock() and pthread_cond_signal() are async-signal-safe.

But I was able to convince myself (and others) that port_send() is
async-signal-safe, and got its manpage fixed to reflect that too.

svc.startd is already using event ports, so using port_send() from the
signal handler seems like the perfect solution: just make the existing
svc.startd wait thread handle the event and exit() the process.

A clean exit, where every thread exits cleanly then main() returns is
probably going to be difficult to implement in a daemon with so many
threads doing such varied things.  I don't think a clean exit is really
needed either.

Nico
-- 

Reply via email to