On Tue, 9 Mar 2010 09:59:30 -0800
Zero Hero <zeroh...@qoobly.com> wrote:

> I'm trying to solve a common problem which occurs when I'm using
> PoCos. The crux of the issue is that a session doing a post to a
> PoCo, needs to stay alive for work done by a secondary post by that
> PoCo.
> 
> Consider:
>     1. Session A posts to Session B
>     2. In Session B event handler, it posts to Session C "on behalf of
> Session A".
>     3. Session B exits event handler.
>     4. Session A dies, because it's event was handled by B, but it
> has no way of knowing Session C is doing something for it.
> 
> Since Session B typically belongs to the "other persons PoCo" (OPPC),
> I can't really get inside of
> it and change it.  So the solution to this problem must not alter the
> code for the OPPC.
> 
> This seems to be a very common second order problem.
> 
> Is there some standard technique for solving this?  I've looked at few
> PoCos for solutions, and
> searched for "continuation" like things (e.g.
> POE::Session::Yield::CC), but these don't seem to
> solve the problem.
> 
> Thanks,
> 
> Zerohero


Typically what you can do is in Session B, increment the reference
count for Session A (access via $_[+SENDER]) until after Session C
notifies Session B that it's work is complete. Then you can decrement
again. 

The other thing you could do is set up Session A to be
persistent in some fashion, such as polling a shared result queue,
where Session C will ultimately dump the result. 

-- 

Nicholas Perez
XMPP/Email: n...@nickandperla.net
http://search.cpan.org/~nperez/
http://github.com/nperez

Reply via email to