mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-05 00:35:32 +02:00
Changed context_t to use new zmq_ctx_* functions
This commit is contained in:
parent
b9d239b0db
commit
6a04e4a7f3
14
zmq.hpp
14
zmq.hpp
@ -241,12 +241,22 @@ namespace zmq
|
|||||||
friend class socket_t;
|
friend class socket_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
inline context_t ()
|
||||||
|
{
|
||||||
|
ptr = zmq_ctx_new ();
|
||||||
|
if (ptr == NULL)
|
||||||
|
throw error_t ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline explicit context_t (int io_threads_)
|
inline explicit context_t (int io_threads_)
|
||||||
{
|
{
|
||||||
ptr = zmq_init (io_threads_);
|
ptr = zmq_ctx_new ();
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
throw error_t ();
|
throw error_t ();
|
||||||
|
|
||||||
|
int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_);
|
||||||
|
ZMQ_ASSERT (rc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZMQ_HAS_RVALUE_REFS
|
#ifdef ZMQ_HAS_RVALUE_REFS
|
||||||
@ -270,7 +280,7 @@ namespace zmq
|
|||||||
{
|
{
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
int rc = zmq_term (ptr);
|
int rc = zmq_ctx_destroy (ptr);
|
||||||
ZMQ_ASSERT (rc == 0);
|
ZMQ_ASSERT (rc == 0);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user