Amos Jeffries <squ...@treenet.co.nz> writes: > On 30/01/2013 2:47 p.m., Rainer Weikusat wrote: >> What's the point of putting these onto the event queue? Wouldn't this >> be better done with something like this? > > The Call queue and the Events queue are drained individually in > alternating fashion. The first 0-delay event will not run until after > the Call queue is empty. > > The Call queue by design lacks anything similar to the 'heavy' event > loop exit point. So an explicit 0-delay event is used to break heavy > sequences of Calls into separate chains. > > Using ScheduleCall immediately would be counter-productive in many of > these cases.
Thank you. The reason I'm asking is mainly because 0-delay events are, according to the comment in schedule, supposed to be executed in FIFO order. Is this generally true for events, ie is the actual ordering criterion always a pair (delay, sequence number) or just for 0-delay events? The sequencing is implicitly guaranteed by an implementation based on inserting events into a 'linear' queue of some kind. It is not guaranteed for a heap-based implementation and would thus need to be dealt with explicitly.