Poking around in signal_handler.c out of curiosity, I came across this:
while(UNLIKELY(close(control_pipe[0])) < 0 && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1])) < 0 && UNLIKELY(errno==EINTR)); (lines 3580-3581)
The UNLIKELY marker normally applies to an entire condition, not just to the integer that's about to be compared to zero. Should this become:
while(UNLIKELY(close(control_pipe[0]) < 0) && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1]) < 0) && UNLIKELY(errno==EINTR));
or is there something I'm not understanding about the nature of UNLIKELY()?
ChrisA
UNLIKELY, as it is defined in pike for gcc means just that the argument is expected to be zero. close returns 0 on success and -1 on failure, so the effect would be the same no matter how the paranthesis is places.
on the other hand, i guess that placement was not intentional and for sure placing it around the comparison is less confusing.
arne
On 05/07/15 04:00, Chris Angelico wrote:
Poking around in signal_handler.c out of curiosity, I came across this:
while(UNLIKELY(close(control_pipe[0])) < 0 && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1])) < 0 && UNLIKELY(errno==EINTR));
(lines 3580-3581)
The UNLIKELY marker normally applies to an entire condition, not just to the integer that's about to be compared to zero. Should this become:
while(UNLIKELY(close(control_pipe[0]) < 0) && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1]) < 0) && UNLIKELY(errno==EINTR));
or is there something I'm not understanding about the nature of UNLIKELY()?
ChrisA
On Thu, May 7, 2015 at 5:29 PM, Arne Goedeke el@laramies.com wrote:
on the other hand, i guess that placement was not intentional and for sure placing it around the comparison is less confusing.
Shall I make the change, then? There's no way it can break anything, right?
ChrisA
Yes, I think it should be changed.
arne
On 05/07/15 09:57, Chris Angelico wrote:
On Thu, May 7, 2015 at 5:29 PM, Arne Goedeke el@laramies.com wrote:
on the other hand, i guess that placement was not intentional and for sure placing it around the comparison is less confusing.
Shall I make the change, then? There's no way it can break anything, right?
ChrisA
On Thu, May 7, 2015 at 8:50 PM, Arne Goedeke el@laramies.com wrote:
Yes, I think it should be changed.
Fixed in 8.1 and 8.0.
ChrisA
pike-devel@lists.lysator.liu.se