mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 00:46:05 +01:00
Problem: socket poller shutdown asserts when context is terminating
Solution: do not call getsockopt to query thread-safety of a socket
This commit is contained in:
parent
32c8abb1d8
commit
87fbb5c447
@ -102,6 +102,11 @@ bool zmq::socket_base_t::check_tag ()
|
|||||||
return tag == 0xbaddecaf;
|
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_,
|
zmq::socket_base_t *zmq::socket_base_t::create (int type_,
|
||||||
class ctx_t *parent_,
|
class ctx_t *parent_,
|
||||||
uint32_t tid_,
|
uint32_t tid_,
|
||||||
|
@ -67,6 +67,9 @@ class socket_base_t : public own_t,
|
|||||||
// Returns false if object is not a socket.
|
// Returns false if object is not a socket.
|
||||||
bool check_tag ();
|
bool check_tag ();
|
||||||
|
|
||||||
|
// Returns whether the socket is thread-safe.
|
||||||
|
bool is_thread_safe () const;
|
||||||
|
|
||||||
// Create a socket of a specified type.
|
// Create a socket of a specified type.
|
||||||
static socket_base_t *
|
static socket_base_t *
|
||||||
create (int type_, zmq::ctx_t *parent_, uint32_t tid_, int sid_);
|
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)
|
static bool is_thread_safe (zmq::socket_base_t &socket)
|
||||||
{
|
{
|
||||||
int thread_safe;
|
// do not use getsockopt here, since that would fail during context termination
|
||||||
size_t thread_safe_size = sizeof (int);
|
return socket.is_thread_safe ();
|
||||||
|
|
||||||
int rc =
|
|
||||||
socket.getsockopt (ZMQ_THREAD_SAFE, &thread_safe, &thread_safe_size);
|
|
||||||
zmq_assert (rc == 0);
|
|
||||||
return thread_safe;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::socket_poller_t::socket_poller_t () :
|
zmq::socket_poller_t::socket_poller_t () :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user