|
From: | Håkan Johansson |
Subject: | Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions |
Date: | Sat, 14 Jan 2012 06:43:08 +0100 |
User-agent: | Alpine 2.00 (DEB 1167 2008-08-23) |
Regarding (p)select and signal races, I did not see the 'self-pipe trick' mentioned in the discussion. Quoting http://www.kernel.org/doc/man-pages/online/pages/man2/select.2.html:
"On systems that lack pselect(), reliable (and more portable) signal trapping can be achieved using the self-pipe trick (where a signal handler writes a byte to a pipe whose other end is monitored by select() in the main program.)"
This fixed a similar problem for me once. There was no select, just reads, but the race was locking a data acquisition system up when bad luck struck.
Cheers, Håkan
[Prev in Thread] | Current Thread | [Next in Thread] |