Hello Experts,

I have problem in starting a thread within my application. From my knowledge, to start a thread, i call the below coding:

// thread function
class MyClass : public CActive
static TInt ThreadFunc(TAny* aNone);

TInt MyClass::ThreadFunc(TAny* aNone)
MyClass* pthis = (MyClass*)aNone;
pthis->iConsole.Printf(_L("TEST")); // print a "test" on the screen
// iConsole is the member function of MyClass
return KErrNone;

void MyClass::ConstructL()
{ ...

// create the thread

RThread mythread;
_LIT(KThreadName, "My Thread");
const TInt KHepaSize = 0X1000000;

TInt result = mythread.Create(KThreadName, (TThreadFunction)ThreadFunc, KDefaultStackSize,
KMinHeapSize, KMinHeapSize, KHeapSize, this, EOwnerThread);


// start the thread

mythread.Resume(); // Run the thread
// it should display a "TEST" in the screen, but it doesn't work
// why ?


So, it compile without errors, but it appear that the thread (or thread function) doesn't run (coz no any print out in my screen). What wrong with my coding ? I have tried to change my Thread function ( TInt ThreadFunc(TAny*) ) to be a global function instead of member function of MyClass, but doesn't work as well. Why ? Thx a lot.

Best regards,