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 KHepaSize = 0x800;
TInt result = mythread.Create(KThreadNam
e, (TThreadFunction)ThreadFun
c, KDefaultStackSize,
KMinHeapSize, KMinHeapSize, KHeapSize, this, EOwnerThread);
User::LeaveIfError(result)
;
// start the thread
mythread.SetPriority(EPrio
rityMuchMo
re);
mythread.Resume(); // Run the thread
...
}
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 ? Is there any example code related to RThread ? How can i get more information of RThread ? Thx a lot.
Best regards,
hing
Start Free Trial