On Thu, Dec 12, 2002 at 05:52:17PM -0600, Garrett Goebel wrote: > > Shouldn't ->yield not just enqueue an event, but also do a timeslice before > returning? I.e., actually yield?
No, it's intent is just to enqueue the event. It's very poorly named in that respect, and there have been motions to rename it. http://poe.perl.org/?POE_RFCs/Rename_yield > If I modify yield by pasting in a $self->run_one_timeslice before returning, > I get the output I expected... but then POE crashes with an internal > consistency error... thrown from _data_ses_get_parent because of this line: > > confess "internal inconsistency" unless exists $kr_sessions{$session}; > > Which I assume happens because the session is being deleted somewhere when > the last event has been invoked, but before the last event handler has > exited... Calling run_one_timeslice() won't guarantee that the "a" event will be handled. The timeslice that gets run might be in some other session, for example. >From the standpoint of yield("event"), it may be more proper for it to call run_one_timeslice() until "event" is dispatched. The combination of post("event") and yield("event") makes this tricky. What if "event" was already in the queue before yield("event") was called? Should we guarantee that the "event" in the yield() call is the one that gets dispatched? In that case, multiple "event" events would be dispatched before yield() returned. Remember that _start is dispatched synchronously during POE::Session->create(). This may cause some timing issues. :) > Is the "-><-a" result more desirable than "->a<-"? And if you don't beat me > to it, would you accept a patch that resulted in "->a<-"? That is, if I > _can_ figure out how to make it work? I would, but only as part of a long, drawn-out deprecation of the current yield() semantics. We would also need a tidy replacement function for yield(), for the people who like its enqueue-only behavior. -- Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/
