Commit 87fbb5c4 authored by Simon Giesecke's avatar Simon Giesecke

Problem: socket poller shutdown asserts when context is terminating

Solution: do not call getsockopt to query thread-safety of a socket
parent 32c8abb1
......@@ -102,6 +102,11 @@ bool zmq::socket_base_t::check_tag ()
return tag == 0xbaddecaf;
}
bool zmq::socket_base_t::is_thread_safe () const
{
return thread_safe;
}
zmq::socket_base_t *zmq::socket_base_t::create (int type_,
class ctx_t *parent_,
uint32_t tid_,
......
......@@ -67,6 +67,9 @@ class socket_base_t : public own_t,
// Returns false if object is not a socket.
bool check_tag ();
// Returns whether the socket is thread-safe.
bool is_thread_safe () const;
// Create a socket of a specified type.
static socket_base_t *
create (int type_, zmq::ctx_t *parent_, uint32_t tid_, int sid_);
......
......@@ -33,13 +33,8 @@
static bool is_thread_safe (zmq::socket_base_t &socket)
{
int thread_safe;
size_t thread_safe_size = sizeof (int);
int rc =
socket.getsockopt (ZMQ_THREAD_SAFE, &thread_safe, &thread_safe_size);
zmq_assert (rc == 0);
return thread_safe;
// do not use getsockopt here, since that would fail during context termination
return socket.is_thread_safe ();
}
zmq::socket_poller_t::socket_poller_t () :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment