in reply to Re: POE::Wheel::ReadWrite: "low priority" events
in thread POE::Wheel::ReadWrite: "low priority" events
Thank you very much Rocco, the idea is clear.
However this assumes that we know which event is issued last - because that event must issue 'process_next_input'.
What if we don't know that - the number and order of events that get generated in the course of processing of a line is more or less random?
I changed your sample so that event step_two sometimes gets issued and sometimes doesn't. Also I added checking get_event_count() to see if there are any further events in the queue. Seems that achieved my goal:
sub do_step_one { print " step one: $_[ARG0]\n"; $_[KERNEL]->yield('step_two', $_[ARG0]) if rand(1) > 0.5; $_[KERNEL]->yield('process_next_input') if $poe_kernel->get_event_co +unt() == 0; } sub do_step_two { print " step two: $_[ARG0]\n"; $_[KERNEL]->yield('process_next_input') if $poe_kernel->get_event_co +unt() == 0; }
Thanks once again for your time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: POE::Wheel::ReadWrite: "low priority" events
by rcaputo (Chaplain) on Jun 24, 2012 at 22:14 UTC | |
by jdporter (Paladin) on Jun 24, 2012 at 22:32 UTC |