On Thu, Jul 17, 2003 at 08:40:44PM -0400, Benjamin Goldberg wrote: > Actually, I'm thinking of something like the following... suppose the > original code is like: > > label_foo: > loop body > branch_address: > branch label_foo > > Add in the following: > > e_handler_foo: > .local PerlHash handlers_with_events > .local int i_have_an_event > handlers_with_events = .... > i_have_an_event = handlers_with_events[cur_thread] > unless i_have_an_event, label_foo > bsr dequeue_events_and_handle_them_all > branch label_foo > > And then, when an event occurs, replace "branch label_foo" with "branch > e_handler_foo". > > When there are no events queued, for any thread, then we change "branch > e_handler_foo" back into "branch label_foo", for speed.
Do we need to do this last bit explicitly? Or can we do it lazily - each time we get called to e_handler when there are no longer events, we change back that instruction. Or is this already done this way? Nicholas Clark