[zeromq-dev] ZeroMQ background threads

Luca Boccassi luca.boccassi at gmail.com
Fri May 19 12:20:57 CEST 2017

On Fri, 2017-05-19 at 11:58 +0200, Francesco wrote:
> Hi,
> I'm using ZeroMQ in an applications with several threads (up to 40).
> I noticed that in the "master" branch of ZeroMQ the background
> threads
> it creates are given a name. That's VERY useful, thanks!

No problem. Had the same issue myself. One day I'd like to further
improve it to have more specific names (I/O, reaper, shutdown), but it
would require a lot more refactoring so for now all threads have the
same name.

> However my question is: my application sets the affinity and the
> priority of all threads it creates explicitly. Of course it  cannot
> set the affinity/priority of ZMQ background threads.
> Is it possible to add an API to get the pthread_t (on Linux) or the
> generic thread handle (platform-dependent) associated with the ZMQ
> background threads?
> In that way my application would be able to set affinity and increase
> priority also of ZMQ background threads...

There is already an API to set those. Check the manpage for
zmq_ctx_set, and the following options: ZMQ_THREAD_SCHED_POLICY

Note that as the manpage says you need to set them before creating any
socket, immediately after creating the context.

Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20170519/aa456833/attachment.sig>

More information about the zeromq-dev mailing list