×

Discussion Board

Results 1 to 2 of 2

Thread: Timer Problem

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    13

    Timer Problem

    Hi,
    I want to check a web site statue every 5 second in a GUI base program. I need a timer and I think RTimer is the best for this purpose. I did below code (this is simplified code) from the sdk examples for an exe program. My problems are as follow:
    1-When I use User::WaitForAnyRequest(); it doesn’t work and exit with panic code (stray section of code).
    2- When I use User::WaitForRequest(heartbeatStatus); It seems to work but I can’t get user events.
    3- What is the correct procedure for this mention?


    void CPlaceLoggerAppContainer::sleep(TInt aTenths)
    {
    // sleep for an interval measured in tenths of a second
    User::After(aTenths * 10000); // just let the User function do it for us
    void MyClass::sleep()
    {
    User::After(10000);
    }

    void MyClass::iLoop()
    {
    // create and initialize heartbeat timer
    RTimer heartbeat;
    TRequestStatus heartbeatStatus;
    heartbeat.CreateLocal();

    heartbeat.After(heartbeatStatus, 100000);

    TInt heartbeatTick = 0;

    for (;
    {

    User::WaitForRequest(heartbeatStatus);
    //User::WaitForAnyRequest();
    // find out which request completed, and handle it
    if (heartbeatStatus != KRequestPending)
    {
    // heartbeat completed so service request
    // take some time over it
    sleep();
    // test whether processing should finish
    if (heartbeatTick >= 10)
    {
    // 10 heart-beats: processing finished
    // finish wait loop
    break;
    }

    heartbeatTick++;
    heartbeat.After(heartbeatStatus, 100000);

    }
    }
    else
    {
    // stray signal
    _LIT(KMsgStraySignal,"Stray signal\n");
    User::Panic(KMsgStraySignal, 1); // panic!
    }

    heartbeat.Close();

    }

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Timer Problem

    one post per question is usually enough, so lets continue the discussions in the other thread: http://discussion.forum.nokia.com/fo...d.php?t=164744

Similar Threads

  1. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  2. SyncML link problem
    By samuel_ in forum Symbian
    Replies: 4
    Last Post: 2009-03-27, 08:02
  3. Strange Problem with Bluetooth Connection
    By bigbadwolf in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-12-06, 09:51
  4. About 6230 Bt Problem
    By eerkek in forum Bluetooth Technology
    Replies: 17
    Last Post: 2005-02-08, 12:33
  5. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •