This document describes how active objects are queued using active schedulers.
Where multiple asynchronous services are used by a program, a wait loop is required.
The CActiveScheduler
class encapsulates the wait loop.
Nearly all threads use an active scheduler. Low-level test programs may have to construct their own active scheduler, but all server threads and all UI programs, have an active scheduler after they have initialized. If an active scheduler is present, active objects may be added to it and removed from it at will.
A thread may not have more than one active scheduler.
Active scheduler provides a non pre-emptive multi-tasking system, using which active objects run on a single thread.
In Symbian platform, it is easier to write a system of co-operating active objects than a system of co-operating threads. The run-time cost of an active object is also significantly less than that of a thread. Creating and destroying active objects is very much more efficient than creating and destroying threads.
When the active scheduler executes its wait loop, the order in which active objects are tested for scheduling is determined by their relative priorities. Most active objects should have a priority of zero and there should be an assumption that their relative position in the queue is irrelevant. No processing should ever depend on the order in which active objects are scheduled.