[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race co
From: |
Greg Troxel |
Subject: |
Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions |
Date: |
Sat, 14 Jan 2012 08:53:37 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (berkeley-unix) |
Mike Frysinger <address@hidden> writes:
> On Saturday 14 January 2012 00:43:08 Håkan Johansson wrote:
>> 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.)"
>
> neat trick, but i wonder if we even have to bother. pselect() has
> been in the Linux kernel (and thus race free) for almost 6 years. the
> select() based code, while admittedly racy, isn't that big of a deal
> -- at worse, the code takes 1 second to respond. i think this is an
> acceptable trade off -- install a kernel from the last 6 years, or
> suck it up ;).
gpsd does not specify Linux as a requirement; it is in theory portable
to any reasonable posix-like system (which perhaps includes windows, and
perhaps doesn't).
But, pselect is specified by posix:
http://pubs.opengroup.org/onlinepubs/009695399/functions/select.html
and is available in NetBSD 5 (perhaps earlier) and FreeBSD from 2002
(and also in OS X 10.7, with the same FreeBSD man page), so I don't see
any issue in relying on it.
pgpK8VxiYPCZP.pgp
Description: PGP signature
- [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eckhart Wörner, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Mike Frysinger, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eckhart Wörner, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Mike Frysinger, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eckhart Wörner, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Mike Frysinger, 2012/01/13
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Håkan Johansson, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Mike Frysinger, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eric S. Raymond, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions,
Greg Troxel <=
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eric S. Raymond, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Greg Troxel, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eckhart Wörner, 2012/01/14
- Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Eric S. Raymond, 2012/01/14
Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions, Dave Platt, 2012/01/13