From 6a04e4a7f3dc4ae5b47c37327cf719c6c906babd Mon Sep 17 00:00:00 2001 From: Colin Steifel Date: Sat, 13 Jul 2013 14:52:51 -0400 Subject: [PATCH] Changed context_t to use new zmq_ctx_* functions --- zmq.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zmq.hpp b/zmq.hpp index 7cc2cf1..5133bce 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -241,12 +241,22 @@ namespace zmq friend class socket_t; public: + inline context_t () + { + ptr = zmq_ctx_new (); + if (ptr == NULL) + throw error_t (); + } + inline explicit context_t (int io_threads_) { - ptr = zmq_init (io_threads_); + ptr = zmq_ctx_new (); if (ptr == NULL) throw error_t (); + + int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); + ZMQ_ASSERT (rc == 0); } #ifdef ZMQ_HAS_RVALUE_REFS @@ -270,7 +280,7 @@ namespace zmq { if (ptr == NULL) return; - int rc = zmq_term (ptr); + int rc = zmq_ctx_destroy (ptr); ZMQ_ASSERT (rc == 0); ptr = NULL; }