mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Problem: loop sending signaler event is obscure
Solution: add comments and remove continue/break
This commit is contained in:
parent
3ace237988
commit
9f16513ebe
@ -183,16 +183,15 @@ void zmq::signaler_t::send ()
|
|||||||
ssize_t sz = write (_w, &inc, sizeof (inc));
|
ssize_t sz = write (_w, &inc, sizeof (inc));
|
||||||
errno_assert (sz == sizeof (inc));
|
errno_assert (sz == sizeof (inc));
|
||||||
#elif defined ZMQ_HAVE_WINDOWS
|
#elif defined ZMQ_HAVE_WINDOWS
|
||||||
unsigned char dummy = 0;
|
const char dummy = 0;
|
||||||
while (true) {
|
int nbytes;
|
||||||
int nbytes =
|
do {
|
||||||
::send (_w, reinterpret_cast<char *> (&dummy), sizeof (dummy), 0);
|
nbytes = ::send (_w, &dummy, sizeof (dummy), 0);
|
||||||
wsa_assert (nbytes != SOCKET_ERROR);
|
wsa_assert (nbytes != SOCKET_ERROR);
|
||||||
if (unlikely (nbytes == SOCKET_ERROR))
|
// wsa_assert does not abort on WSAEWOULDBLOCK. If we get this, we retry.
|
||||||
continue;
|
} while (nbytes == SOCKET_ERROR);
|
||||||
|
// Given the small size of dummy (should be 1) expect that send was able to send everything.
|
||||||
zmq_assert (nbytes == sizeof (dummy));
|
zmq_assert (nbytes == sizeof (dummy));
|
||||||
break;
|
|
||||||
}
|
|
||||||
#elif defined ZMQ_HAVE_VXWORKS
|
#elif defined ZMQ_HAVE_VXWORKS
|
||||||
unsigned char dummy = 0;
|
unsigned char dummy = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user