mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-02 15:41:40 +02:00
Add explicit close method to context_t
This commit is contained in:
parent
f957e25a3f
commit
ce3e3e2f9a
6
zmq.hpp
6
zmq.hpp
@ -236,11 +236,17 @@ namespace zmq
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline ~context_t ()
|
inline ~context_t ()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void close()
|
||||||
{
|
{
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
int rc = zmq_term (ptr);
|
int rc = zmq_term (ptr);
|
||||||
ZMQ_ASSERT (rc == 0);
|
ZMQ_ASSERT (rc == 0);
|
||||||
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Be careful with this, it's probably only useful for
|
// Be careful with this, it's probably only useful for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user