[zeromq-dev] Perl question: ZMQ + AnyEvent
Robert Olson
olson at mcs.anl.gov
Sat Sep 22 00:41:03 CEST 2012
On Sep 21, 2012, at 5:31 PM, Pedro Melo wrote:
> Hi,
>
> On Fri, Sep 21, 2012 at 9:11 PM, Robert Olson <olson at mcs.anl.gov> wrote:
>> On Sep 21, 2012, at 2:30 PM, Robert Olson wrote:
>>> However, in my client, if I set up AnyEvent to wait for the reply from the broker I am never notified. The client works perfectly if I use a synchronous receive on the socket.
>>
>> Interesting: in the async code if I issue a nonblocking recv() before I drop into the AnyEvent wait code, it works properly. Is this the expected behavior?
>
> My gut felling when I read your code was that it was correct, it would
> be the code I would write in this situation. Adding that nonblocking
> read seems to be clearing some flag that signals the socket as
> "nothing more to read at the moment" but I don't remember the
> existence of such a flag…
>
> I would do one thing though: move from ZeroMQ binding to the new ZMQ
> bindings. The second ones are written as a direct map to the C API
> (like ZeroMQ::Raw) but are supported, where as ZeroMQ has several open
> bugs without answers. One particular problem is with ZeroMQ and
> fork's, you'll get a libzmq assertion. Fixed in ZMQ.
Ah, excellent - I hadn't come across the ZMQ bindings. I'll look into that.
Thanks.
--bob
More information about the zeromq-dev
mailing list