Hi,
My active object has a method to listening the USB event. Can the RunL method be interrupted when the USB event
is comming. In my code trace, It looks that the RunL is interrupted, and then the RunL is never resumed.
Do you have ideas about the problem.
The AO looks like:
class MyAO: public CActive
{
public:
RunL();
HandleUSBEvent();
}
Re: Can active object RunL method be interrupted, when the activ
Difficult to say what is happening without seeing more of your code. In most situation, the RunL cannot be interrupted . At least This is the case in a single threaded context. So another function executing in the same thread cannot preempt the execution, provided that you don't play with a second Active Scheduler or WaitForRequest within the RunL).
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Thank you very much,
It is right that RunL is non-preemted, I found the error about my code. The RunL leaves.
If my CActive object listen the hardware event, when the RunL is running, can the hardware event enter? If not, what about missing the event; if so the RunL atomic is crashed.
Re: Can active object RunL method be interrupted, when the activ
active objects don't work as you seem to think.
non of your active objects code is running while it is waiting for the event.
In case of no events incomeing, your thread will sleep and do nothing, within the active scheduler loop. (a call to RSemaphore::Wait())
when an event occours, your thread is _not_ run immediatly, the only thing that happens is that RSemaphore::Signal() is called, wich causes a counter to increased, and your thread will be scheduled to run.
When the thread then runs (which could take some time if other high priority threads is hogging the CPU), the AS will then start process the event by finding the active object that has its iStatus set to ERequestComplete and call that AO:s RunL function.
If another event occours while the RunL is processing, all that happens is that the request counter is increased one more step, so the Active Scheduler loop will loop once more, processing also this event, before putting the thread to sleep again.
Forum posts: 1913
Difficult to say what is happening without seeing more of your code. In most situation, the RunL cannot be interrupted . At least This is the case in a single threaded context. So another function executing in the same thread cannot preempt the execution, provided that you don't play with a second Active Scheduler or WaitForRequest within the RunL).
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 14
Thank you very much,
It is right that RunL is non-preemted, I found the error about my code. The RunL leaves.
If my CActive object listen the hardware event, when the RunL is running, can the hardware event enter? If not, what about missing the event; if so the RunL atomic is crashed.
Forum posts: 1155
active objects don't work as you seem to think.
non of your active objects code is running while it is waiting for the event.
In case of no events incomeing, your thread will sleep and do nothing, within the active scheduler loop. (a call to RSemaphore::Wait())
when an event occours, your thread is _not_ run immediatly, the only thing that happens is that RSemaphore::Signal() is called, wich causes a counter to increased, and your thread will be scheduled to run.
When the thread then runs (which could take some time if other high priority threads is hogging the CPU), the AS will then start process the event by finding the active object that has its iStatus set to ERequestComplete and call that AO:s RunL function.
If another event occours while the RunL is processing, all that happens is that the request counter is increased one more step, so the Active Scheduler loop will loop once more, processing also this event, before putting the thread to sleep again.