Christian,
> What about something like this:
>
> diff --git a/src/mailbox.cpp b/src/mailbox.cpp
> index c186007..3cf8640 100644
> --- a/src/mailbox.cpp
> +++ b/src/mailbox.cpp
> @@ -73,7 +73,14 @@ 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);
> + break;
> + }
> wsa_assert (nbytes != SOCKET_ERROR);
> zmq_assert (nbytes == sizeof (command_t));
> }
>
Even easier way to accomplish the above would be to use blocking send.
That was how the code looked like formerly. However, it can lead to
deadlocks. Thus, the only way the handle the problem is to increase the
send buffer to accomodate the command.
Martin
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev