[zeromq-dev] context
Pieter Hintjens
ph at imatix.com
Thu Aug 26 11:52:33 CEST 2010
On Thu, Aug 26, 2010 at 11:42 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
>> Hopefully in 0MQ/3.0 we can remove this argument from the API and
>> configure I/O threads using zmq_setctxopt() for those cases that need
>> it.
>
> The problem is you have to launch the I/O threads before doing any other
> work and you can't change the setting once they are launched. AFAICS there's
> no simple API abstraction other than zmq_init parameter.
Yes, there is a simple API abstraction that is 100% coherent with what
we do for sockets, and which has been extensively discussed on this
list already. I'm not going to lookup all the old threads cause email
ain't a database but we've gone over this several times...
0MQ can accept the zmq_setctxopt(ctx, ZMQ_IOTHREADS..) if the context
hasn't been used yet, and raise an error if it's used later. Perhaps
at some future time it'll be possible to change this dynamically.
That solves two specific and recurrent problems:
* It creates an extensibility point for context configuration that
gives full backwards compatibility for the API. Recall that this
specific API call changed in 2.0.7, causing breakage to all APIs.
* It removes this argument that confuses many new users and has no
meaning in 99% of use cases. Yet every example, every explanation
needs to cover it.
So, AFAICS there is a simpler and more coherent API.
-Pieter
More information about the zeromq-dev
mailing list