[zeromq-dev] PATCH: zmq::signaler_t should not assert on EINTR

Martin Lucina mato at kotelna.sk
Fri Aug 6 12:01:50 CEST 2010


sustrik at 250bpm.com said:
> Martin Lucina wrote:
> > Hi Dhammika,
> > 
> > dhammika at gmail.com said:
> >> Hi,
> >>
> >>>  -    ssize_t nbytes = send (w, &cmd_, sizeof (command_t), 0);
> >>>  +    ssize_t nbytes;
> >>>  +    do {
> >>>  +        ::send (w, &cmd_, sizeof (command_t), 0);
> >>>  +    } while (nbytes == -1 && errno == EINTR);
> >>
> >> small typo, nbytes uninitialized.
> > 
> > No, that's why those are all (not just the one you write about) do while
> > loops rather than just plain loops.
> > 
> > Unless something changed since I learned C, the while() part of a do while
> > loop is only evaluated after the body has been run at least once.
> 
> You've missed the point. It's a typo here:
> 
>  >>>  +        ::send (w, &cmd_, sizeof (command_t), 0);

Yes, I realised that about 5 seconds after sending this email.

Fixed it now.

Sorry, need coffee :-)

-mato



More information about the zeromq-dev mailing list