zmq_recv zmq_send handle EINTR

This commit is contained in:
leiyz 2021-12-30 18:28:24 +08:00
parent a98fa4a91d
commit 5d76925f90

20
zmq.hpp
View File

@ -1889,7 +1889,7 @@ class socket_base
int nbytes = zmq_send(_handle, buf_, len_, flags_);
if (nbytes >= 0)
return static_cast<size_t>(nbytes);
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return 0;
throw error_t();
}
@ -1901,7 +1901,7 @@ class socket_base
int nbytes = zmq_msg_send(msg_.handle(), _handle, flags_);
if (nbytes >= 0)
return true;
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return false;
throw error_t();
}
@ -1916,7 +1916,7 @@ class socket_base
int nbytes = zmq_msg_send(msg.handle(), _handle, flags_);
if (nbytes >= 0)
return true;
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return false;
throw error_t();
}
@ -1941,7 +1941,7 @@ class socket_base
zmq_send(_handle, buf.data(), buf.size(), static_cast<int>(flags));
if (nbytes >= 0)
return static_cast<size_t>(nbytes);
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return {};
throw error_t();
}
@ -1951,7 +1951,7 @@ class socket_base
int nbytes = zmq_msg_send(msg.handle(), _handle, static_cast<int>(flags));
if (nbytes >= 0)
return static_cast<size_t>(nbytes);
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return {};
throw error_t();
}
@ -1969,7 +1969,7 @@ class socket_base
int nbytes = zmq_recv(_handle, buf_, len_, flags_);
if (nbytes >= 0)
return static_cast<size_t>(nbytes);
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return 0;
throw error_t();
}
@ -1981,7 +1981,7 @@ class socket_base
int nbytes = zmq_msg_recv(msg_->handle(), _handle, flags_);
if (nbytes >= 0)
return true;
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return false;
throw error_t();
}
@ -1998,7 +1998,7 @@ class socket_base
(std::min)(static_cast<size_t>(nbytes), buf.size()),
static_cast<size_t>(nbytes)};
}
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return {};
throw error_t();
}
@ -2012,7 +2012,7 @@ class socket_base
assert(msg.size() == static_cast<size_t>(nbytes));
return static_cast<size_t>(nbytes);
}
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
return {};
throw error_t();
}
@ -2662,7 +2662,7 @@ template<typename T = no_user_data> class poller_t
return static_cast<size_t>(rc);
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3)
if (zmq_errno() == EAGAIN)
if (zmq_errno() == EAGAIN || zmq_errno() == EINTR)
#else
if (zmq_errno() == ETIMEDOUT)
#endif