how to use AnyEvent::Handle on the child of AnyEvent::Run (aka portable_socketpair)?

Marc Lehmann schmorp at schmorp.de
Thu Nov 21 08:11:48 CET 2013


On Thu, Nov 21, 2013 at 12:57:49AM -0500, Fulko Hew <fulko.hew at gmail.com> wrote:
> 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,

You can still send events from the worker to the parent to request
information (via AnyEvent::Fork::RPC::event), so you wouldn't really need
to redesign, you'd just have to think of ::event as a request, and the
request sent (in response, by the parent) as delivering the request info.

> 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

The fact that the default backend actually is blocking is a big hint that
blocking is fine, don't you think so? :)

>       Example 3: Asynchronous backend with Coro
> 
>    Unfortunately, my children do (must) block, and that breaks this
> approach.

Why do you (wrongly) think that blocking breaks anything? What do you
think breaks when you block?

>    That's why I wanted 'real' forked children.

I feel you are overly negative towards working approaches :)

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list