messagingfw/watcherfw/test/src/t_forever.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // t_forever.cpp
       
    15 //
       
    16 
       
    17 #include <watcher.h>
       
    18 #include "cwatcher.h"
       
    19 
       
    20 LOCAL_C void DoStartL()
       
    21 	{
       
    22 	CActiveScheduler::Install(new(ELeave)CActiveScheduler);
       
    23 	CWatcherWait* wait = CWatcherWait::NewLC();
       
    24 		
       
    25 	CWatcher* watcher = CWatcher::NewL(CActive::EPriorityStandard);
       
    26 	FOREVER
       
    27 		{
       
    28 		wait->Start();
       
    29 		watcher->Start(wait->iStatus);
       
    30 		CActiveScheduler::Start();
       
    31 		}
       
    32 	delete watcher;
       
    33 	
       
    34 	CleanupStack::PopAndDestroy(); // wait
       
    35 	delete CActiveScheduler::Current();
       
    36 	}
       
    37 
       
    38 GLDEF_C TInt E32Main()
       
    39 	{       
       
    40 	__UHEAP_MARK;
       
    41 	CTrapCleanup* theCleanup=CTrapCleanup::New();
       
    42 	TRAPD(ret,DoStartL());          
       
    43 	delete theCleanup;      
       
    44 	__UHEAP_MARKEND;
       
    45 	return(KErrNone);
       
    46 	}
       
    47 
       
    48 EXPORT_C TInt WinsMain()
       
    49 	{
       
    50 #if defined(__WINS__)
       
    51 	E32Main();
       
    52 #endif
       
    53 	return KErrNone;
       
    54 	}
       
    55