Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2006-05-09 16:39:22

Aristid Breitkreuz wrote:
> Am Dienstag, den 09.05.2006, 19:22 +0000 schrieb Ryan Gallagher:
>> Gennadiy Rozental wrote:
>>> SIGNAL catching is optional and doesn't constitute portabiltiy issues per se,
>>> whether to use it's up to you.
>> Out of curiousity, what is a good (portable?) way of dealing with signals in
>> C++? C signal handling seems to force globals on you, which is a pain
>> especially when signal handling is a late requirement.
> You might want to use a UNIX pipe for that (by calling pipe(2)). Just
> write(2) into a pipe (less than PIPE_BUF bytes) and select(2) on it.
> This is thread-safe and signal-safe and everything. Just not too speedy.

I think semaphores are a widespread way to communicate from signal handlers
back to a running program. They are reentrant, and their use involves less
system calls than pipes, I believe.

I don't think thinking of portable signal handling mechanisms is sensible,
as signals themselves are (mostly) non-portable.


Boost list run by bdawes at, gregod at, cpdaniel at, john at