[zeromq-dev] Using multiple contexts

2011-08-12 Thread Christian Martinez
Is there a downside to using multiple contexts? I have a class wrapper I'd like to keep as simple as possible. I can either modify it to allow multiple connects, sockets etc under a single context or leave it as is and have clients of the wrapper instantiate it multiple times. --CM

[zeromq-dev] Using multiple contexts

2010-09-13 Thread Martin Sustrik
Hi Pieter, One frequent misuse of 0MQ is that newbies tend to open multiple context objects with no apparent reason. What about explaining the correct usage in the user guide? The _only_ use case for multiple contexts is this one: Person A writes a library using 0MQ. Person B writes another li

Re: [zeromq-dev] Using multiple contexts

2011-08-12 Thread Chuck Remes
On Aug 12, 2011, at 1:11 PM, Christian Martinez wrote: > Is there a downside to using multiple contexts? I have a class wrapper I’d > like to keep as simple as possible. I can either modify it to allow multiple > connects, sockets etc under a single context or leave it as is and have > clients

Re: [zeromq-dev] Using multiple contexts

2011-08-13 Thread Pieter Hintjens
On Fri, Aug 12, 2011 at 8:11 PM, Christian Martinez wrote: > Is there a downside to using multiple contexts? I have a class wrapper I’d > like to keep as simple as possible. I can either modify it to allow multiple > connects, sockets etc under a single context or leave it as is and have > client

Re: [zeromq-dev] Using multiple contexts

2010-09-13 Thread Martin Sustrik
On 09/14/2010 07:56 AM, Martin Sustrik wrote: > Hi Pieter, > > One frequent misuse of 0MQ is that newbies tend to open multiple context > objects with no apparent reason. > > What about explaining the correct usage in the user guide? > > The _only_ use case for multiple contexts is this one: > > Pe

Re: [zeromq-dev] Using multiple contexts

2010-09-14 Thread Daisuke Maki
My tests do this in the same file: { # test case 1 my $ctxt = ZeroMQ::Context->new(); # internally calls zmq_init(); ... test code here } # contxt freed { # test case 2 my $ctxt = ZeroMQ::Context->new(); # internally calls zmq_init(); ... test code here .

Re: [zeromq-dev] Using multiple contexts

2010-09-14 Thread Pieter Hintjens
Hi Daisuke, You can create and destroy contexts in a test case like that, as long as you're aware that these are separate 0MQ instances that can't communicate over inproc:. Forking is something we didn't cover yet in the Guide. You cannot create a context and pass it to a child process. The pro

Re: [zeromq-dev] Using multiple contexts

2010-09-14 Thread Martin Sustrik
On 09/14/2010 10:40 AM, Pieter Hintjens wrote: > Hi Daisuke, > > You can create and destroy contexts in a test case like that, as long > as you're aware that these are separate 0MQ instances that can't > communicate over inproc:. Correct. > Forking is something we didn't cover yet in the Guide.

Re: [zeromq-dev] Using multiple contexts

2010-09-21 Thread Martin Lucina
p...@imatix.com said: > Hi Daisuke, > > You can create and destroy contexts in a test case like that, as long > as you're aware that these are separate 0MQ instances that can't > communicate over inproc:. Yes, using multiple contexts is useful for test programs where you want to excersize the API

Re: [zeromq-dev] Using multiple contexts

2010-09-21 Thread Pieter Hintjens
On Tue, Sep 21, 2010 at 8:39 AM, Martin Lucina wrote: > Um, fork() is orthogonal to any 0MQ contexts. fork() creates a completely > new process, so if that process created any contexts before the fork() > those are now also present in the child. Yes, of course... I'm not sure why I thought cont