how to use AnyEvent::Handle on the child of AnyEvent::Run (aka portable_socketpair)?
Fulko Hew
fulko.hew at gmail.com
Thu Nov 21 06:57:49 CET 2013
Although I did get my bi-directional JSON connected parent/slave
test program to work... the 2nd child doesn't communicate.
[Its attached if anyone cares to look.]
On Wed, Nov 20, 2013 at 10:28 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Wed, Nov 20, 2013 at 10:10:06AM -0500, Fulko Hew <fulko.hew at gmail.com>
> wrote:
> > Because Perl threading would force my variable-sharing issues to be
> > extremely
> > complicated, I wanted to move instead to: a simple, low-count,
> multi-process
> > approach with a simple (JSON) message passing between them.
>
> For me, that's what AnyEvent::Fork::RPC does (JSON is one of the
> serialisation formats it supports out of the box. Soon, I'll add CBOR
> which should make it even faster).
>
... so I thought I'd take Marc's suggestion and look at AnyEvent-Fork-RPC.
a) it operates backwards to what I was trying to do.
ie. it allows RPCing into child threads, to ask them to be workers.
but what I wanted were workers that allowed RPCing the parent
to retrieve info regarding what the workers need to do,
So, after re-designing to suit this inverse approach, I continued
testing...
b) I get further with respect to multi-threaded operation, but it looks like
the RPC/children of an AnyEvent::Fork application must be non-blocking,
as in the
Example 3: Asynchronous backend with Coro
Unfortunately, my children do (must) block, and that breaks this
approach.
That's why I wanted 'real' forked children.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20131121/3f81934b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: statd_anyevent_test_1
Type: application/octet-stream
Size: 3904 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20131121/3f81934b/attachment-0001.obj>
More information about the anyevent
mailing list