mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-04-19 23:50:41 +02:00
Merge pull request #6 from ricnewton/context_close
Add explicit close method to context_t
This commit is contained in:
commit
bdabaafd63
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