Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader03.nrc01.news.zen.net.uk.POSTED!not-for-mail From: Nobody Subject: Re: Safe accesses of global arrays in signal handlers? Date: Sun, 30 Sep 2012 20:46:24 +0100 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.programming.threads,comp.unix.programmer References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lines: 14 Organization: Zen Internet NNTP-Posting-Host: 09748773.news.zen.co.uk X-Trace: DXC=`13DZb]1\PkdM2Z^cWRFGAkgRaQ@lNY<`b X-Complaints-To: abuse@zen.co.uk Xref: csiph.com comp.programming.threads:1127 comp.unix.programmer:3390 On Sun, 30 Sep 2012 13:12:27 +0200, Markus Elfring wrote: >> The signal handler only needs to write one byte at a time; >> the receiving thread can read a pipe-full at a time. If the receiving >> thread does nothing but notify worker threads or enqueue messages, >> there shouldn't be a problem. > > Is it a software design challenge to forward the number that was passed > to this callback function into the dedicated pipe? Using a pipe is fine if you just want to wake a thread when something interesting has happened, but if you're trying to turn signals into events, the sigwaitinfo() approach is the way to go.