Problem with DoRunL()

Login to reply to this topic.
Tue, 2008-05-06 08:06
Joined: 2006-04-19
Forum posts: 128

Hi ,

I am using CPeriodic class. Mine problem is my control got struck in DoRunl() this I came to know through debug.I don't know how
to proceed now as I can't do more debug. One thing more I want to tell i.e this is not the only timer that I am using. There are some other
timers also but by doing debug so many time I have made sure myself that all the timers are handled properly.So now at this stage I am totally blank.
I need some pointers.

I'll be greatfull for your kind help and suggestions.

Thanks&Regards
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".


Tue, 2008-05-06 08:10
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 1886
Re: Problem with DoRunL()

AFAIK CPeriodic don't have any DoRunL() method. So might be that it would be a good idea to post a bit of code.
Also check that you are not using User::WaitForRequest() (or at least that you are totally sure that your usage of this function won't block your thread).


Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

Tue, 2008-05-06 08:25
Joined: 2006-04-19
Forum posts: 128
Re: Problem with DoRunL()

Hi Eric,

at first thanks for your quick reply. If CPeriodic don't have any DoRunL() then why my control is going there.

sample code is

//**************************************************************************
InvokeTimerL()
 {
 if(!iTimer)
  {
  iTimer= CPeriodic::NewL(CActive::EPriorityHigh);
  }
 if(iTimer->IsActive())
  {
  iTimer->Cancel();
  }
  
 iTimer->Start(1,  
      KSeconds * 1/4,  /* 1/4th Secs */
      TCallBack(StartMyFunc,
      this));
  }

StartMyFunc(TAny* aThis)
 {
  static_cast CMyView*(aThis)->DoSomeThing();    //have removed brackets as it was not displaying CMyview
  return KErrNone;
 }
DoSomeThing()
{
}

//***************************************************************************

Here this func StartMyFunc never get called . the sequence is :

InvokeTimerL()

void CPeriodic::RunL()

void CActiveScheduler::DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj)

Here it got struck.

Thanks & Regards
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".

Tue, 2008-05-06 12:52
Joined: 2005-04-13
Forum posts: 90
Re: Problem with DoRunL()

Just to reconfirm Please check the return type of your callback method, which must be TInt


Jupitar

Tue, 2008-05-06 12:58
Joined: 2006-04-19
Forum posts: 128
Re: Problem with DoRunL()

Hi

Thanks for your reply. Ya, return type is TInt . Sorry I just pasted sample ruf code. Sorry for that.

Regards,
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".

Tue, 2008-05-06 13:46
Joined: 2004-11-29
Forum posts: 1134
Re: Problem with DoRunL()

The code you provide and the sequence you claim to get doesn't make sense, it should not be possible.

So either you didn't give your whole code, or you have misunderstood something during debugging, and you don't really get the results you claim to get...

"DoRunL" is an internal function in the active scheduler, and is the function that calls the RunLs of your active objects
So DoRunL will call your RunL but not the other way around.
the RunL of CPeriodic couldn't call InvokeTimerL directly with the code you give, neither could InvokeTimerL call RunL...
RunL of the CPeriodic could only call your callback function, directly calling a member function of an object should not be possible unless you have some linking inconsistency.

If your "DoSomething" in turn calls "InvokeTimerL" then you might have a problem, I don't think its a good idea to call Start on the CPeriodic from within the callback handle, but neither should you have to, since the CPeriodic will automatically call RTimer::After internally after your callback has returned.
I'm not sure that would result in a hang though.

Tue, 2008-05-06 14:14
Joined: 2006-04-19
Forum posts: 128
Re: Problem with DoRunL()

Hi alh,

Thanks for your reply as I was eagerly waiting for some reply.

Let me clear one thing my CPeriodic's RunL is not calling InvokeTimerL () . I am calling this function at particular event. And this function should call StartMyFunc() and then only Runl() call again and again StartMyFunc() and that will call in turn DosomeThing() until timer will get expired. I think this should be the sequence.

I am not very good in depth of Active Objects and I know only the upper layer because of that I think I am not getting the right point.

As I told you this is not the only timer that I am using in the same class. All the others are working fine and I am using in the same manner and during debugging I notice this sequence.

InvokeTimerL ()
StartMyFunc() // at end press F10
void CPeriodic::RunL() // at end press F10
void CActiveScheduler::DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj) // Here pressF5
StartMyFunc()
void CPeriodic::RunL()
void CActiveScheduler::DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj)
.
.
.
.
.
This is the sequence and it'll go on until timer will get expire. That only I observe during debug.

And mine problem is in the sequence when I call InvokeTimer() instead calling StartMyFunc() its directly going void CPeriodic::RunL()
void CActiveScheduler::DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj)
and got struck here no panic also.

Please give me some pointer as I got struck badly here since last 10 days Sad

Thanks & Regards
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".

Wed, 2008-05-07 12:16
Joined: 2004-11-29
Forum posts: 1134
Re: Problem with DoRunL()

I have a hard time trying to understand what you write.
Specially this part confuses me a lot and I can't make any sense out of it:


Let me clear one thing my CPeriodic's RunL is not calling InvokeTimerL () . I am calling this function at particular event. And this function should call StartMyFunc() and then only Runl() call again and again StartMyFunc() and that will call in turn DosomeThing() until timer will get expired. I think this should be the sequence.

I also don't understand why you step into the acticescheduler code and why you step into the CPeriodic::RunL code...

What is also weird is that the code you show in your post should work fine, are you really sure it really looks like that?

What do you really mean by "sequence"? Do you have a few breakpoints in the code, and it stops at these points in this order?
If so, there could happen a lot of other things too in between, and you need to look more carefully on what really happens.
I find it very unlikely that you calling InvokeTimerL would result in a call to RunL.
Though, its very likely that you stop in RunL after calling InvokeTimerL, but it should not be the timer you just invoked, but another of your timers..

How many timers do you use?
I'm sure there is some upper limit on how many you can use in a thread, but I don't know what it is. Maybe that could be cause of your problems...

Wed, 2008-05-07 13:55
Joined: 2006-11-23
Forum posts: 15
Re: Problem with DoRunL()

Hi Isha,

I have tried to recreate the problem you are facing in a uiq sample application (see the attachment) using the same code you have posted here, but failed Sad , and the sample application is working fine as per expectation. May this sample will help you to sort out your problem and if still problem exist then reproduce your problem by modifying this sample application and post here so that we can know the exact problem you are facing.....

Br,
Pankaj

AttachmentSize
HelloWorld.zip71.91 KB

Pankaj Dubey

  • Login to reply to this topic.