×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    How to suspend a function in single thread while other function executing

    Hello my problem is same as question.....

    I am calling one synch function inside which an asynch function is called .... now my requirement is : The rest of the function must suspend till the completion of the Asynch request.....

    Code:
    class A{
    Function1()
    {
    Function2();
    //should Suspend here till the call of the runL of
    //the internal function
    ...
    ...
    ..
    ..
    .
    }
    };
    
    Class B : Public CActive
    {
    Function2()
    {
    Function3(TRequestStatus aStatus);
    }
    RunL()
    {
    //Here i will trigger the Suspended function..
    }
    };
    At Last i want to remind you that all processing is in Single thread...

    Thanx and Regards,
    Pawan Gupta

  2. #2
    Super Contributor
    Join Date
    Jul 2008
    Location
    Chennai,India
    Posts
    889

    Re: How to suspend a function in single thread while other function executing

    Try this..

    Code:
    class A{
    Function1()
    {
    Function2(status);
    User::WaitforRequest(status)...

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to suspend a function in single thread while other function executing

    what types of functions you have in your class A ... if those fuctions will do some actions on the output of class B then i suggest using a state machine in Class A and one state call Class B and change only change Class A's state after class B finishes,

  4. #4
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    Re: How to suspend a function in single thread while other function executing

    PHP Code:
    class A{
    Function1()
    {
    Function2(status);
    User::WaitforRequest(status)... 
    It will suspend the whole thread...

    Well i come up the solution too

    CActiveSchedulerWait will be better choice as i did.... if any other better solution plz post it here..

  5. #5
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: How to suspend a function in single thread while other function executing

    Or split Function1() into two functions and B::RunL() calls the second function (if class B knows about class A).

    Or turn class A itself into an active object state machine and the code before B is executed one state and the code that gets executed ager B::RunL() is another state.

    Or CActiveSchedulerWait may be the simplest solution as you have already used.

    You haven't given much detail about A or the relationship between A and B so can't comment further.

Similar Threads

  1. Replies: 11
    Last Post: 2008-05-13, 16:36
  2. Synchronized calls in a single thread
    By tote_b5 in forum Symbian
    Replies: 2
    Last Post: 2008-05-12, 21:31
  3. Network communication and Server-Client Thread errors.
    By mujtaba_muji in forum Mobile Java General
    Replies: 0
    Last Post: 2007-06-09, 07:33
  4. Link errors when trying to Display bitmap
    By Bkc82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-01-16, 23:46
  5. Working With Sockets Using A Single Thread
    By mrmlk in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2003-09-26, 07:21

Posting Permissions

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