summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Hintjens <ph@imatix.com>2010-08-06 11:09:29 +0200
committerPieter Hintjens <ph@imatix.com>2010-08-06 11:09:29 +0200
commit2100a9133312f7feecd22c4f809c8f3912c93274 (patch)
tree0a470abd6ed59606d8d381159484cb663a413f7b
parent78e9ee84bf0e89eeb7134771b1f501ea0f9ccd9d (diff)
parent16b43e657b44902b3b45fbb01228c813cf27ad39 (diff)
Merge branch 'master' of github.com:zeromq/zeromq2
-rw-r--r--src/signaler.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/signaler.cpp b/src/signaler.cpp
index 592688b..b2055bf 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -176,7 +176,10 @@ zmq::signaler_t::~signaler_t ()
void zmq::signaler_t::send (const command_t &cmd_)
{
- 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);
errno_assert (nbytes != -1);
zmq_assert (nbytes == sizeof (command_t));
}
@@ -194,7 +197,10 @@ bool zmq::signaler_t::recv (command_t &cmd_, bool block_)
}
bool result;
- ssize_t nbytes = recv (r, buffer, sizeof (command_t), 0);
+ ssize_t nbytes;
+ do {
+ nbytes = ::recv (r, buffer, sizeof (command_t), 0);
+ } while (nbytes == -1 && errno == EINTR);
if (nbytes == -1 && errno == EAGAIN) {
result = false;
}
@@ -249,7 +255,10 @@ void zmq::signaler_t::send (const command_t &cmd_)
{
// TODO: Note that send is a blocking operation.
// How should we behave if the command cannot be written to the signaler?
- ssize_t nbytes = ::send (w, &cmd_, sizeof (command_t), 0);
+ ssize_t nbytes;
+ do {
+ nbytes = ::send (w, &cmd_, sizeof (command_t), 0);
+ } while (nbytes == -1 && errno == EINTR);
errno_assert (nbytes != -1);
// This should never happen as we've already checked that command size is
@@ -259,8 +268,11 @@ void zmq::signaler_t::send (const command_t &cmd_)
bool zmq::signaler_t::recv (command_t *cmd_, bool block_)
{
- ssize_t nbytes = ::recv (r, cmd_, sizeof (command_t),
- block_ ? 0 : MSG_DONTWAIT);
+ ssize_t nbytes;
+ do {
+ nbytes = ::recv (r, cmd_, sizeof (command_t),
+ block_ ? 0 : MSG_DONTWAIT);
+ } while (nbytes == -1 && errno == EINTR);
// If there's no signal available return false.
if (nbytes == -1 && errno == EAGAIN)