i am interested to know , how does a wait dialog manages it's internal loop, i mean when u do a executeLD on it, this function returns only on user activity but u're phone is still usable; how is this wait loop implemented?
Active objects: the "loop" is actually the thread's active scheduler, and the dialog just implements a RunL that does some small task (in wait dialog's case, update the animation I would presume) and then re-schedules itself to run. This way, the phone remains responsive because the scheduler can choose other tasks to execute also (e.g. key events, other animations on the background, etc.).
Now, if you're asking how you can "block" the execution yourself so that you can implement this, it's done with CActiveSchedulerWait class (can't remember which header it's in, sorry, try to search for it). The code goes something like this:
Code:
class CSomeClass : public CBase { // This is your dialog class or whatever private: CActiveSchedulerWait iWait; // This is a C class so it can't be on stack, // But it can be a member variable of another C-class. };
// Actual code:
iWait.Wait; // This instantiates another scheduler loop.
// Somewhere else in the code, (e.g. in OkToExitL or ProcessCommandL):
iWait.AsyncStop();
// Execution continues, but once this active objects RunL finishes // it returns to the original loop.
Ok, sorry about the uninformative example. I'm just typing it from memory.
Forum posts: 21
Now, if you're asking how you can "block" the execution yourself so that you can implement this, it's done with CActiveSchedulerWait class (can't remember which header it's in, sorry, try to search for it). The code goes something like this:
// This is your dialog class or whatever
private:
CActiveSchedulerWait iWait; // This is a C class so it can't be on stack,
// But it can be a member variable of another C-class.
};
// Actual code:
iWait.Wait; // This instantiates another scheduler loop.
// Somewhere else in the code, (e.g. in OkToExitL or ProcessCommandL):
iWait.AsyncStop();
// Execution continues, but once this active objects RunL finishes
// it returns to the original loop.
Ok, sorry about the uninformative example. I'm just typing it from memory.
Forum posts: 206
guda