×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    36

    problem in threading

    Hi All,

    I am writing some code on "HandleServerAppContainerViewActivatedL" function.

    Now I want to invoke a new thread on a worker function Test().

    For this I am writing code like this...

    RThread mythread;
    _LIT(KThreadName, "My Thread");
    const KHepaSize = 0x800;
    TInt result = mythread.Create(KThreadName, (TThreadFunction)test, KDefaultStackSize,KMinHeapSize, KMinHeapSize, KHeapSize, this, EOwnerThread);
    User::LeaveIfError(result);
    mythread.SetPriority(EPriorityMuchMore);
    mythread.Resume(); // Run the thread



    and the test function is like ...

    void test(TAny* aPtr){

    ------
    }

    but on compilation it says undefined test.
    I tried the function like CServerAppContainerView::test...but even in this case it gives undefined test.

    how can I create a thread for a user defined worker function?

    Thanks

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

    Re: problem in threading

    Are these global functions? If so, has the "test" function declared before the call?

    Also test is a static function belonging to RTest, so try using some other name.

    You can have a look at the "Transient server example - test program " in the documentation.
    Regards

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

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    36

    Re: problem in threading

    I tried changing the name...but the same error :(

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

    Re: problem in threading

    how about checking this
    Regards

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

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    36

    Re: problem in threading

    the example that u have given uses the worker function that inherits from the same class....in my case I am not able to create a function like CServerAppContainerView:: function() because this is the designer class and has fixed no. of function .

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

    Re: problem in threading

    Hi,

    First of all I think the no of parameters passed to create function is wrong.

    Secondly why are you passing "this" pointer.

    Also I am not able to understand why is it that you cant make a new function part of your class. You probably wont be able to pass global function to the thread.
    Regards

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

Similar Threads

  1. Problem in threading operation...
    By krmlkr in forum Mobile Java General
    Replies: 5
    Last Post: 2008-05-28, 10:20
  2. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11: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
  •  
×