[zeromq-dev] Mac OS X: test_shutdown_stress sometimes fails
Christian Gudrian
christian at gudrian.org
Fri Nov 12 12:04:15 CET 2010
Am 12.11.2010 12:00, schrieb Christian Gudrian:
> What about something like this:
Sorry, I've forgotten the "else":
diff --git a/src/mailbox.cpp b/src/mailbox.cpp
index c186007..827326c 100644
--- a/src/mailbox.cpp
+++ b/src/mailbox.cpp
@@ -73,7 +73,15 @@ void zmq::mailbox_t::send (const command_t &cmd_)
// TODO: Implement SNDBUF auto-resizing as for POSIX platforms.
// In the mean time, the following code with assert if the send()
// call would block.
- int nbytes = ::send (w, (char *)&cmd_, sizeof (command_t), 0);
+ int nbytes;
+ while (true)
+ {
+ nbytes = ::send (w, (char *)&cmd_, sizeof (command_t), 0);
+ if ((nbytes == SOCKET_ERROR) && (GetLastError () == WSAEWOULDBLOCK))
+ Sleep (1);
+ else
+ break;
+ }
wsa_assert (nbytes != SOCKET_ERROR);
zmq_assert (nbytes == sizeof (command_t));
}
Christian
More information about the zeromq-dev
mailing list