[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

6907: [MUD-Dev] Re: Yet another update on threads and signals

[Full Header] [Plain Text]
From: s001gmu@nova.wright.edu
Newsgroups: nu.kanga.list.mud-dev
Date: Fri, 14 Aug 1998 14:32:05 -0400 (EDT)
References: [1]
Organization: Kanga.Nu
On Fri, 14 Aug 1998, Adam J. Thornton wrote:

> OK, so trapping the signal in a signal handler won't work, because the
> POSIX thread functions are not reentrant.
> 
> However, using sigwait() will, so instead of a signal handler, I'll spawn a
> thread whose only purpose in like is to wait for that signal and, upon
> receiving it, do its magic.  It can just block in sigwait() until the
> signal is delivered.

I do recall thinking that this was the best way to handle signals with
threads.  Just have all threads but one block all signals (that they can),
and leave that one thread as a signal handler.  There is a section in the
POSIX book on pthreads that discusses threads and signals, but I don't
remember much other than the signal-handler thread method.  If people are
interested, I can re-read it and summarize the chapter and post it here
later tonight/tomorrow.

-Greg