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

Martin Lucina mato at kotelna.sk
Fri Aug 6 11:46:38 CEST 2010


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.

-mato



More information about the zeromq-dev mailing list