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

Martin Sustrik sustrik at 250bpm.com
Fri Aug 6 11:57:27 CEST 2010


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

Martin



More information about the zeromq-dev mailing list