×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    15

    How to quickly break CActive's long running RunL() ?

    Hello!

    Is it possible to break immediately in responsive way the longer running procedure step implemented in CActive's RunL or I have to split this longer procedure step in another CActive object? The execution time of my RunL() procedure depends on amount of data it processes in step(sometimes one step is fast (below 1 sec), sometimes not (several secs)).To be more precise in one step I open one found file and search some text to be replaced. This process takes more time if the file is longer.
    If I call CActive::Cancel() it is noticed in the next round by the next file but not immediatelly. Is it possible to break CActive immediatelly (or kill CActive) from HandleCommandL() in UI Container which created CActive?
    Last edited by studnokia; 2008-05-21 at 02:06.

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

    Re: How to quickly break CActive's long running RunL() ?

    Nope, you can not stop other Active objects executing their RunL.

  3. #3
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Lightbulb Re: How to quickly break CActive's long running RunL() ?

    Hi,

    Moreover active objects should be used to break a long running task into smaller tasks.

    Your RunL should complete its task quickly. If you have lot of things to do, better to implement a state machine.

    Regards
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  4. #4
    Registered User
    Join Date
    May 2005
    Posts
    15

    Re: How to quickly break CActive's long running RunL() ?

    I have chosen CActive for processing searched files and save phone keypad responsive from UI. I search for one file and process it in one RunL() cycle, but it limits me to stop this RunL(). My next idea is to try RThread to achieve kill/stop processing. Is it any smarter way to fight with this problem?

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    104

    Re: How to quickly break CActive's long running RunL() ?

    If you want to stop blocking one thread, always try posting that process to some other thread.

    Try to split your task to be done into smaller chunks and try to achieve them using different active object.

    y not with someother thread, if u r sure that it doesnt malfunction.

  6. #6
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: How to quickly break CActive's long running RunL() ?

    usage of separate thread is highly discouraged and should be done only if there exists no other solution. Hence doing it with various active objects seems to be a better option
    Amit Kankani
    Nokia Developer Champion

  7. #7
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Post Re: How to quickly break CActive's long running RunL() ?

    Hi,

    I am not sure I understand what you are trying to do.. But basically I would say if you have to read through a very long file, you could probably split the read into smaller parts and check the result in RunL and if you dont find your desired result, just setactive to go in waitloop again.

    This will mean that your other active objects get a fair chance for servicing request.

    Avoid Threads as far as possible.

    Regards
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  8. #8
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: How to quickly break CActive's long running RunL() ?

    I suggest you decide the priority of your task, if its low priority wrap your task as short increments into active object, implement some kind of internal state machine and let it continue in background by generating your own events.

    By keeping short increments you are able to control your active object in much better way.

  9. #9
    Registered User
    Join Date
    May 2005
    Posts
    15

    Re: How to quickly break CActive's long running RunL() ?

    This state machine/thread can fail inside and I want to have chance to kill it's task/thread/method from application UI. If I see it is "timeouted" or for user request.

  10. #10
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Cool Re: How to quickly break CActive's long running RunL() ?

    Hi,

    This should be easy. Again for this to happen, first you need to break you tasks into smaller incremental tasks.
    And associate a timer and start the timer before/after and check at the end of timer whether your task is completed.

    As to your user requesting a cancelling the request, you can call active objects Cancel() method. This should do the cancelling and cleanup (of course you need to implement the method :) ).

    Regards
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: How to quickly break CActive's long running RunL() ?

    A simple example for such incremental operation can be found in Examples\Base\IPC\Async\Fibonacci3.

Similar Threads

  1. breakpoints disabled when running debugger.
    By nawkboy in forum Symbian
    Replies: 4
    Last Post: 2012-05-31, 10:45
  2. writing a long running process
    By sajindra in forum Symbian
    Replies: 1
    Last Post: 2004-05-04, 03:54
  3. PC Connectity with VB6
    By mkintanar in forum PC Suite API and PC Connectivity SDK
    Replies: 5
    Last Post: 2003-09-24, 04:18
  4. Replies: 2
    Last Post: 2003-09-01, 22:15
  5. breakpoints disabled when running debugger
    By nawkboy in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2003-02-20, 03:43

Posting Permissions

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