telephonyprotocols/pdplayer/umts/test/te_spud/src/ActiveSchedulerThread.cpp
changeset 38 b6a16c6baaa3
parent 0 3553901f7fa8
equal deleted inserted replaced
37:2c74b432a438 38:b6a16c6baaa3
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    27 #include "cpdpfsmfactory.h"
    27 #include "cpdpfsmfactory.h"
    28 
    28 
    29 /**
    29 /**
    30  Creates and starts the active scheduler, and initializes the units under test
    30  Creates and starts the active scheduler, and initializes the units under test
    31  */
    31  */
    32 void ActiveSchedulerMainL(CInputRequestListener* aListener, TThreadId aParentThreadId)
    32 void ActiveSchedulerMainL(CInputRequestListener* aListener)
    33 	{
    33 	{
    34 	CActiveScheduler *sched = new(ELeave) CActiveScheduler;
    34 	CActiveScheduler *sched = new(ELeave) CActiveScheduler;
    35 	CleanupStack::PushL(sched);
    35 	CleanupStack::PushL(sched);
    36 	CActiveScheduler::Install(sched);
    36 	CActiveScheduler::Install(sched);
    37 	
       
    38 	aListener->iParentThread.Open(aParentThreadId);
       
    39 	
    37 	
    40 	__UHEAP_MARK;
    38 	__UHEAP_MARK;
    41 
    39 
    42 	CActiveScheduler::Add(aListener);
    40 	CActiveScheduler::Add(aListener);
    43 	
    41 	
    61 	__UHEAP_MARKEND;
    59 	__UHEAP_MARKEND;
    62 
    60 
    63 	CleanupStack::PopAndDestroy(sched);	
    61 	CleanupStack::PopAndDestroy(sched);	
    64 
    62 
    65 	// inform the main test thread that this thread is finished and that there are no memory leaks
    63 	// inform the main test thread that this thread is finished and that there are no memory leaks
    66 	TRequestStatus *destuctedStatus = &aListener->iThreadDestructed;
    64 	TRequestStatus *destructedStatus = &aListener->iThreadDestructed;
    67 	aListener->iParentThread.RequestComplete(destuctedStatus, KErrNone);
    65 	aListener->iParentThread.RequestComplete(destructedStatus, KErrNone);	
    68 	aListener->iParentThread.Close();
       
    69 	}
    66 	}
    70 	
    67 	
    71 /**
    68 /**
    72  Create the trap cleanup and calls the main thread f'n
    69  Create the trap cleanup and calls the main thread f'n
    73  */
    70  */
    78 		{
    75 		{
    79 		return KErrNoMemory;
    76 		return KErrNoMemory;
    80 		}
    77 		}
    81 	
    78 	
    82 	TActiveSchedulerThreadParams *params = (TActiveSchedulerThreadParams*)aActiveSchedulerParams;
    79 	TActiveSchedulerThreadParams *params = (TActiveSchedulerThreadParams*)aActiveSchedulerParams;
    83 	TRAPD(err, ActiveSchedulerMainL(params->iListener, params->iThreadId));
    80 	TRAPD(err, ActiveSchedulerMainL(params->iListener));
    84 	
    81 	
    85 	delete cleanup;
    82 	delete cleanup;
    86 	
    83 	
    87 	return err;
    84 	return err;
    88 	}
    85 	}