[zeromq-dev] Context delayed creation

Pieter Hintjens ph at imatix.com
Wed Sep 7 00:05:48 CEST 2011


Something we discussed a few times but never implemented: delaying
context creation to allow configuration.

The way this is done in CZMQ is to create the context when it's first
used, i.e. first socket is created. You might need an extra API
function to explicitly initialize a context if you want to pass it to
child threads in parallel.

The API would become:

zmq_ctx_t *context = zmq_ctx_new ();
zmq_ctx_set_iothreads (context, N); // if N not 1
zmq_ctx_set_maxsockets (context, M); // if M not = 512
zmq_ctx_set_maxvsmsize (context, S);

and finally,
zmq_ctx_destroy (context);

It's not feasible to change this for 2.x but we could do that for 3.x and 4.x.


More information about the zeromq-dev mailing list