0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Merge pull request #3757 from sigiesec/fix-windows-signaler-regression

Fix windows signaler regression
This commit is contained in:
Luca Boccassi 2019-12-10 18:41:35 +00:00 committed by GitHub
commit eb54966cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,10 +183,14 @@ void zmq::signaler_t::send ()
ssize_t sz = write (_w, &inc, sizeof (inc));
errno_assert (sz == sizeof (inc));
#elif defined ZMQ_HAVE_WINDOWS
unsigned char dummy = 0;
const int nbytes =
::send (_w, reinterpret_cast<char *> (&dummy), sizeof (dummy), 0);
wsa_assert (nbytes != SOCKET_ERROR);
const char dummy = 0;
int nbytes;
do {
nbytes = ::send (_w, &dummy, sizeof (dummy), 0);
wsa_assert (nbytes != SOCKET_ERROR);
// wsa_assert does not abort on WSAEWOULDBLOCK. If we get this, we retry.
} 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));
#elif defined ZMQ_HAVE_VXWORKS
unsigned char dummy = 0;