Merge pull request #6 from ricnewton/context_close

Add explicit close method to context_t
This commit is contained in:
Pieter Hintjens 2012-08-28 21:10:36 -07:00
commit bdabaafd63

View File

@ -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