×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Question waiting for completion

    How can i make a non active object class wait for an active request to complete? when i used cactivescheduler wait it paincked with cbase91 (This panic is raised by CActiveSchedulerWait::Start() when the CActiveSchedulerWait object has already been started.
    )

    but I wonder who has called the start !!

    My situation is like this

    void CNonActiveclass::ReadFromSock( buffer ) // has no active scheduler for this thread
    {
    iEngine->Read(buf);

    }

    ...
    void CEngine::Read(buffer)
    {
    iSockreader->read(buf);
    }



    void CSockReader::Read(buf)// Cactive class

    {

    if( !IsActive() )
    {
    iSocket.Read( buf, iStatus );
    SetActive();
    }
    }

    Now I want to block the CNonActiveclass:: ReadFromSock () from finishing till the CSockReader::Read has been handled. so what should i Do?
    I tried a wait in

    void CNonActiveclass::ReadFromSock( buffer ) // has no active scheduler for this thread
    {
    iEngine->Read(buf);
    cactivesheulerwait :.start(); this panicked after setactive was called in CSockReader::Read(buf)


    }

    can any one suggest something?


    -J
    Last edited by julie_777; 2012-03-07 at 09:13.

  2. #2
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: waiting for completion

    CSockReader is in a different thread ... i think it wont matter and the painic happens in iWait.Start();

  3. #3
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: waiting for completion

    I allocated CActiveSchedulerWait oh heap now the panic changed from 91 to 46! but I wonder how this can be a stray signal! i have a installed an activescheduler for this class now

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: waiting for completion

    Important thing: objects do not belong to threads. If you create an object in thread1, but invoke its dosomething() in thread2, dosomething() will run in thread2.
    Also, CActiveSchedulerWait requires an installed CActiveScheduler, check its Start/Stop method in the documentation and its reference to E32USER-CBase 44.
    If you do not get this panic, your code is actually running in a totally different thread (probably the UI thread), than what you expect (in the comments you write about 2 threads, both of them having no active scheduler).

  5. #5
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: waiting for completion

    oki thanks ... now I realized the flaw. now I want a thread that can be in a wait loop till some buffer is filled for writing , can i achieve this this active objects? like main thread fills data to a buffer/Q the other thread which has an active obj polls the Q for data and writes! can i use some other trigger instead of polling in a loop to trigger writes?

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: waiting for completion

    You can use RSemaphore/RMutex for signalling when something is ready. It is also possible to manually complete iStatus from an other thread (or in fact, from any thread), just you will need RThread::RequestComplete (see #19 of http://www.developer.nokia.com/Commu...s-with-CActive for this one)

Similar Threads

  1. Code completion
    By ojve in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 7
    Last Post: 2009-06-22, 09:52
  2. Word completion
    By pravesh3127 in forum Symbian
    Replies: 0
    Last Post: 2008-05-12, 10:20
  3. Word Completion?
    By runl2 in forum Symbian
    Replies: 2
    Last Post: 2006-09-01, 07:42
  4. how to wait for completion...
    By GeKI in forum Symbian
    Replies: 1
    Last Post: 2006-02-02, 18:56

Posting Permissions

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