i create a new thread in my program based on S60.i debug my program by using VC IDE on S60 emulator. when the thread tried to open contact database,the thread was closed after failing to open contact database. i have used many ways to find the reason, i failed.who can tell me the reason?
my code in the follow:
void XXXXXXXX::CreateThread()
{
TInt error = iThreadHandlePackage.Create(_L( "HandlePackageByThread") ,
HandlePackageByThread,
1024*10, //stack size
1024*10, //min heap size
1024*60, //max heap size
iSyncInfo,
EOwnerThread);
if(error != KErrNone)
return;
iThreadHandlePackage.Resume();
iThreadCreated = ETrue;
iThreadRunning = ETrue;
}
TInt XXXXXXX::HandlePackageByThread(TAny *aPtr)
{
CContactDatabase* contactsDb;
TRAPD(error,contactsDb = CContactDatabase::OpenL();
if(error != KErrNone)
return FAIL_OPEN_DATABASE;
delete contactsDb;
}

Reply With Quote

