On Wed, Sep 21, 2005 at 09:04:05AM +0900, Ara.T.Howard wrote:
> 
> how do signal handlers affect threads? specifically, if a resource must be
> accessed by only one thread at a time and also is accessed from a handler,
> what protection should be used?

I smell deadlock issues.  I have always delegated any shared resource action
required by a signal handler to another thread.

The problem is that a signal is an async event that can interrupt your process
in an indeterminate state.  You should do as little as possible in the signal
handler and delegate any real work to something in the main flow of the program,
say another thread.

One way is to set up a queue where the reader is the other thread that
actually does whatever is required by the signal handler with the shared resource.

Rick

-- 
Rick Nooner
rick / nooner.net
http://www.nooner.net