Discussion Board

Results 1 to 2 of 2

Thread: CActive

  1. #1
    Regular Contributor
    Join Date
    Feb 2006


    Hi, ALL!!!

    Tell me plz somebody may i use CActive object to control state of variable, with no blocking work of main thread???

    - if not, what i need to use???
    - if yes, then why my code not working properly???

    here some example code:

    class CMyMMFDataPath: public CMMFDataPath

    CMMFDataPath derived from CActive, and it's already has CActiveScheduler object

    CMMFDataPath(TMediaId aMediaId, MAsyncEventHandler& aEventHandler)
    : CActive(EPriorityStandard), MDataSink(KUidMmfDataPath), MDataSource(KUidMmfDataPath), iEventHandler(aEventHandler), iMediaId(aMediaId), iState(EStopped)

    void CMyMMFDataPath::PlayL()
    (reinterpret_cast<CActiveScheduler *>(this))->Start();

    void CMyMMFDataPath::Activate()
    PrintStr("Activating active object");
    TRequestStatus* status = &iStatus;
    User::RequestComplete(status, KErrNone);

    void CMyMMFDataPath::RunL()
    PrintStr("RunL started");
    if (iStatus == KErrNone)
    //if (iDataPathState)
    PrintNum("state of datapath: %B", iDataPathState);
    iDataPathState = EFalse;


    void CMyMMFDataPath:oCancel()


    Wbr, Yuri

  2. #2
    Registered User
    Join Date
    Aug 2003
    Oulu, Finland

    Re: CActive

    I'm not sure what you're trying to accomplish (please explain).

    Some issues with your code:
    (reinterpret_cast<CActiveScheduler *>(this))->Start();
    CActive is not a CActiveScheduler so this cast does not do what you think. And I think you don't want to call CActiveScheduler::Start() anyway - active scheduler is already running if you're running inside the application framework. If not, even then an active object's setup function is not the right place to start it.

    In RunL() you call SetActive() without setting up an asynchronous request.


Similar Threads

  1. CActive related problem
    By white_dragon in forum Symbian
    Replies: 4
    Last Post: 2006-01-09, 09:53
  2. CActive and cancel
    By yaront in forum Symbian
    Replies: 0
    Last Post: 2005-01-27, 14:29
  3. Cancelling CActive and RunL
    By yaront in forum Symbian
    Replies: 3
    Last Post: 2005-01-12, 08:45
  4. CActiveScheduler & CActive Objects
    By Kalderas in forum Symbian
    Replies: 0
    Last Post: 2003-08-07, 12:33
  5. Two CActive object conflict ?
    By rbwilliams2 in forum Symbian
    Replies: 0
    Last Post: 2003-03-26, 20:52

Posting Permissions

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