From ce3e3e2f9a0125998f368895bd5be4a98da7366a Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Tue, 28 Aug 2012 13:49:14 +0100 Subject: [PATCH] Add explicit close method to context_t --- zmq.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zmq.hpp b/zmq.hpp index 1b7c8a6..c804b37 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -236,11 +236,17 @@ namespace zmq #endif inline ~context_t () + { + close(); + } + + inline void close() { if (ptr == NULL) return; int rc = zmq_term (ptr); ZMQ_ASSERT (rc == 0); + ptr = NULL; } // Be careful with this, it's probably only useful for