[zeromq-dev] app_threads in zmq_init() call

Jarred Ward jarred at webriots.com
Sat Apr 17 02:18:19 CEST 2010

> > I have a question about the app_threads parameter of the zmq_init() call.
> > My application creates thread on user request which may use a ZMQ
> > socket. I am not able to know in advance what will be the exact number
> > of threads running in my application.
> > Which value can I give to this app_threads parameter in this case?
> > Do I have to inform the ZMQ context that a new thread has been created
> > (or distroyed)?
> There's no such way. 0MQ needs to know max number of threads in advance
> so that it can initialise the lock-free infrastructure (channels between
> individual threads).
> However, note the app_thread is max number of threads that can open 0MQ
> sockets _in parellel_. This means that once thread X closes all the
> socket it owns, another thread can take its place.
> Thus I would just estimate how many threads are going to use 0MQ in
> parallel (10, 100, 1000?) and set the context accordingly.

You start getting invalid value when you set app_threads above 63. Line 226
in zmq.cpp. I imagine there is a good reason for this limitation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100416/27a3b307/attachment.htm>

More information about the zeromq-dev mailing list