[zeromq-dev] Working around threads-per-context

Matt Weinstein mattweinstein at gmail.com
Mon Jul 12 14:46:53 CEST 2010


Folks,

In order to try to workaround the (current) pre-defined thread-per- 
context limitation in the zeromq library(*), I thought I would simply  
create a new context when I ran out of threads in the "current" context.

However, http://api.zeromq.org/zmq_inproc.html says (RT*M) :  "The in- 
process transport passes messages via memory directly between threads  
sharing a single ØMQ context.".

Normally I don't quibble about these things, but isn't this really  
"incontext:" rather than "inproc:"?  :-)

I'd like to be able to spawn a new ZMQ_QUEUE, and have it forward to  
another ZMQ_QUEUE in a different "concentrator" context:




Unfortunately, this won't work, since I can't poll across contexts.

So, I'm stuck using an actual TCP: loopback to get the result I want.


Is there any hope of either (a) a multi-context poll; or (b) a multi- 
context namespace for inproc: calls (presumably less efficient due to  
the required barriers).

In the case of the multi-context namespace, I might suggest creating a  
new object type (a shared namespace) and providing options to  
associate contexts with namespaces:

	zmq_namespace(const char* namespace);	// might be superfluous,  
depending on your feelings about globals.

	zmq_setcontextopt(ZMQ_NAMESPACE);  // context options return ? :-)

Binding would be to e.g. "name://" instead of "inproc:", etc.

May I also humbly suggest that the tag "inproc:" by changed to e.g.  
"ctx:" or "context:" to reflect its true nature?

Feedback welcome. :-)

Best,

Matt

(*) I'm doing this in order to ensure that we don't have to build a  
special version of zeromq for different production environments.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100712/b7d9f1c1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zmq_context.jpg
Type: image/jpeg
Size: 90422 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100712/b7d9f1c1/attachment.jpg>


More information about the zeromq-dev mailing list