gpsd-dev
[Top][All Lists]
Advanced

[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: Mike Frysinger
Subject: Re: [gpsd-dev] [PATCH] Use pselect() to reduce wakeups and avoid race conditions
Date: Sat, 14 Jan 2012 01:25:45 -0500
User-agent: KMail/1.13.7 (Linux/3.2.0; KDE/4.6.5; x86_64; ; )

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 ;).
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]