×
Namespaces

Variants
Actions
(Difference between revisions)

WISE Thread Interface

From Nokia Developer Wiki
Jump to: navigation, search
ebra (Talk | contribs)
(New page: == Description == == Maemo Platform == <code> </code> == S60 Platform == <code> TInt ThreadEntry(TAny* aPtr) { CTrapCleanup* cleanupStack = CTrapCleanup::New(); if ( cleanupStac...)
 
ebra (Talk | contribs)
(S60 Platform)
Line 1: Line 1:
 
 
== Description ==
 
== Description ==
  
Line 10: Line 9:
 
== S60 Platform ==
 
== S60 Platform ==
 
<code>
 
<code>
TInt ThreadEntry(TAny* aPtr)
+
TInt ThreadFunction(TAny* aPtr)
 
{
 
{
CTrapCleanup* cleanupStack = CTrapCleanup::New();
+
CWISEEngine* engine = (CWISEEngine*)aPtr;
 +
TInt state = engine->Logger().GetState();
 +
if ( state < 2 )
 +
{
 +
if ( state==0 ) engine->SyncronizeClientL();
 +
else            engine->SyncronizeServerL();
 +
engine->Logger().SetState(2);
 +
}
 +
else if ( state==3 )
 +
{
 +
engine->Logger().Flush();
 +
CActiveScheduler::Stop();
 +
}
 +
return 0;
 +
}
 +
</code>
 +
<code>
 +
TInt ThreadEntry(TAny* aPtr)
 +
    {
 +
    CTrapCleanup* cleanupStack = CTrapCleanup::New();
 
     if ( cleanupStack )
 
     if ( cleanupStack )
 
         {
 
         {
 
         TRAPD( err, 
 
         TRAPD( err, 
        CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+
            CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
        CleanupStack::PushL( scheduler );
+
            CleanupStack::PushL( scheduler );
        CActiveScheduler::Install( scheduler );
+
            CActiveScheduler::Install( scheduler );
 
        
 
        
        CWISEEngine* eng = CWISEEngine::NewLC(*((CWISELogger*)aPtr));
+
            CWISEEngine* eng = CWISEEngine::NewLC(*((CWISELogger*)aPtr));
 
          
 
          
        CPeriodic* periodic = CPeriodic::NewL(CActive::EPriorityLow);
+
            CPeriodic* periodic = CPeriodic::NewL(CActive::EPriorityLow);
        CleanupStack::PushL(periodic);
+
            CleanupStack::PushL(periodic);
        periodic->Start(1000, 1000000, TCallBack(ThreadFunction, eng));
+
            periodic->Start(1000, 1000000, TCallBack(ThreadFunction, eng));
  
        CActiveScheduler::Start();
+
            CActiveScheduler::Start();
        CleanupStack::PopAndDestroy(3);
+
            CleanupStack::PopAndDestroy(3);
        );
+
        );
 
         delete cleanupStack;
 
         delete cleanupStack;
 
         cleanupStack = NULL;
 
         cleanupStack = NULL;
 
         }
 
         }
 
     return KErrNone;
 
     return KErrNone;
}
+
    }
 
</code>
 
</code>
  
 
== Links ==
 
== Links ==

Revision as of 15:31, 17 June 2008

Contents

Description

Maemo Platform

 

S60 Platform

TInt ThreadFunction(TAny* aPtr)
{
CWISEEngine* engine = (CWISEEngine*)aPtr;
TInt state = engine->Logger().GetState();
if ( state < 2 )
{
if ( state==0 ) engine->SyncronizeClientL();
else engine->SyncronizeServerL();
engine->Logger().SetState(2);
}
else if ( state==3 )
{
engine->Logger().Flush();
CActiveScheduler::Stop();
}
return 0;
}
TInt ThreadEntry(TAny* aPtr)
{
CTrapCleanup* cleanupStack = CTrapCleanup::New();
if ( cleanupStack )
{
TRAPD( err,
CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
CleanupStack::PushL( scheduler );
CActiveScheduler::Install( scheduler );
 
CWISEEngine* eng = CWISEEngine::NewLC(*((CWISELogger*)aPtr));
 
CPeriodic* periodic = CPeriodic::NewL(CActive::EPriorityLow);
CleanupStack::PushL(periodic);
periodic->Start(1000, 1000000, TCallBack(ThreadFunction, eng));
 
CActiveScheduler::Start();
CleanupStack::PopAndDestroy(3);
);
delete cleanupStack;
cleanupStack = NULL;
}
return KErrNone;
}

Links

42 page views in the last 30 days.