Example #1
0
//
// Remote (i.e. running in its own process) child's entry point.
// Note that the child's process entry point is still E32Main() process (see below)
//
TInt ChildMain(TBMSpawnArgs* args)
	{
	args->iChildOrigPriority = BMProgram::SetAbsPriority(RThread(), args->iChildPrio);
		// get a handle to the parent's thread in the child's context.
	TInt r = args->iParent.Open(args->iParentId);
	BM_ERROR(r, r == KErrNone);
	return args->iChildFunc(args);
	}
// -----------------------------------------------------------------------------
// CSensrvTest::OpenChannelL
// Parameters: ChannelId(TUint32), ContextType(TInt), Quantity(TInt), 
//              ChannelType(TUint32), dataSize(TInt), Location(TDesC8), VendorId(TDesC8)(optional)
// 
// -----------------------------------------------------------------------------
//
TInt CSensrvTest::OpenChannelL( CStifItemParser& aItem )
    {
    RDebug::Print(RThread().Name());
    RDebug::Print( _L("CSensrvTest::OpenChannelL") );
    RDebug::Print( _L("CSensrvTest::OpenChannelL: Get parapeters") );
    
    TSensrvChannelInfo channelInfo;
    
    TInt err = ParseChannelInfo( channelInfo, aItem );
    
    if( err )
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL: parameter error: %d"), err );
        return err;
        }
    
    iChannelInfoList.Reset();
        
    err = FindChannels( iChannelInfoList, channelInfo );
    if( err )
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL: FindChanels error: %d"), err );
        return err;
        }
    if( iChannelInfoList.Count == 0 )
        {
        RDebug::Print( _L("CSensrvTest::FindChannelsL: Channel not found" ) );
        return KErrNotFound;
        }
    if( !iSensorChannel )
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL - Create iSensorChannel...") );
        RDebug::Print( _L("CSensrvTest::OpenChannelL - ChannelId = %d "), iChannelInfoList[ 0 ].iChannelId );
        iSensorChannel = CSensrvSensorChannel::NewL( iChannelInfoList[ 0 ] );
        RDebug::Print( _L("CSensrvTest::OpenChannelL - iSensorChannel Created") );
        }
        
    RDebug::Print( _L("CSensrvTest::OpenChannelL - Open channel %d"), iChannelInfoList[ 0 ].iChannelId );
    TRAP( err, iSensorChannel->OpenChannelL() );
    TInt openedChannel( 0 );
    RProperty::Get( KPSUidSensrvTest, KSensrvLatestOpenedChannel, openedChannel );
    if( err )
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL - Open channel error %d"), err );
        }
    else if( openedChannel != iChannelInfoList[ 0 ].iChannelId )
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL - Incorrect channel opened."), err );
        RDebug::Print( _L("CSensrvTest::OpenChannelL - opened hannel: %d"), openedChannel );
        err = KErrGeneral;
        }
    else
        {
        RDebug::Print( _L("CSensrvTest::OpenChannelL - Channel open") );
        }
   
    return err;
    }
SilcThread silc_thread_self(void)
{
#ifdef SILC_THREADS
  RThread thread = RThread();
  return (SilcThread)&thread;
#else
  return NULL;
#endif
}
CFlushActive::CFlushActive(CMD5Active& aBufferHandler):
CActive(CActive::EPriorityHigh),    // Higher priority than CMD5Active to ensure we run before them when the Active Scheduler is picking who to run next
iBufferHandler(aBufferHandler)
    {
    CActiveScheduler::Add(this);
    iRunLContext = RThread();
    iStatus = KRequestPending;
    SetActive();
    }
CTestBase::~CTestBase()
	{
	//
	// Restore the process and thread priority...
	//
	RProcess().SetPriority(iOrgProcessPriority);
	RThread().SetPriority(iOrgThreadPriority);
	
	}
TVerdict CSimNoConfigFileTest::doTestStepL()
	{
	INFO_PRINTF1(_L("Testing Phone open without Config File present"));
	DeleteConfigFileL();
	TESTL(iPhone.Open(iTelServer,KPhoneName)==KErrNotFound);
	iPhone.Close();
	ASSERT(RThread().RequestCount()==0);
	return TestStepResult();
	}
Example #7
0
extern "C" TLinAddr GetEka1ExeEntryPoint()
	{
	TLinAddr a = 0;
	RLibrary l;
	TInt r = l.Load(KEka1EntryStubName, KNullDesC, TUidType(KDynamicLibraryUid, KEka1EntryStubUid));
	if (r == KErrNone)
		r = l.Duplicate(RThread(), EOwnerProcess);
	if (r == KErrNone)
		{
		a = (TLinAddr)l.Lookup(1);
		if (!a)
			r = KErrNotSupported;
		}
	if (r != KErrNone)
		RThread().Kill(r);
	Exec::SetReentryPoint(a);
	return a;
	}
Example #8
0
GLDEF_C TInt E32Main()
    {
    // Change the priority to high during initial application loading.
    // It will be lowered back in app ui constructor.
    // If priority < high, app framework will lower it to background since
    // SysAp is started up as a background application.
    RThread().SetProcessPriority( EPriorityHigh );
    return EikStart::RunApplication(NewApplication);
    }
Example #9
0
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
CATExtSrv* CATExtSrv::NewLC()
    {
    CATExtSrv* self = new (ELeave) CATExtSrv( EPriorityNormal );
    CleanupStack::PushL( self );
    self->ConstructL();
    self->StartL( KATExtSrvName );
    RThread().SetPriority( EPriorityNormal );
    return self;
    }
Example #10
0
TInt CCollector::ThreadFunc(TAny* aParams) // for sensor thread
	{
	CTrapCleanup* cleanupStack = CTrapCleanup::New();
	TRAPD(err,
			CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
			CleanupStack::PushL(activeScheduler);
			CActiveScheduler::Install(activeScheduler);
			CCollector* collector = (CCollector*) aParams;
			TNode* node = collector->GetNode();
			if(node->iType == TNode::EACC)
				{
					CAccelerometer* acc=NULL;
					acc = CAccelerometer::NewLC();
					collector->SetSensor(acc);
					acc->SetReceiver(collector);
					RThread().Rendezvous(KErrNone);
					CActiveScheduler::Start();
					CleanupStack::PopAndDestroy(acc);
					collector->SetSensor(NULL);
				}
			else if(node->iType == TNode::EBTECG)
				{
					CAliveECG* ecg=NULL;
					ecg = CAliveECG::NewLC(node->iAddress, node->iPort);
					collector->SetSensor(ecg);
					ecg->SetReceiver(collector);
					RThread().Rendezvous(KErrNone);
					CActiveScheduler::Start();
					CleanupStack::PopAndDestroy(ecg);
					collector->SetSensor(NULL);
				}
			else if(node->iType == TNode::EBTSPO2)
				{
					CAliveSpO2* spO2=NULL;
					spO2 = CAliveSpO2::NewLC(node->iAddress, node->iPort);
					collector->SetSensor(spO2);
					spO2->SetReceiver(collector);
					RThread().Rendezvous(KErrNone);
					CActiveScheduler::Start();
					CleanupStack::PopAndDestroy(spO2);
					collector->SetSensor(NULL);		
				}
			CleanupStack::PopAndDestroy(activeScheduler);
	);
// -----------------------------------------------------------------------------
// CAdvancedAudioRecordController::CAdvancedAudioRecordController
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
EXPORT_C CAdvancedAudioRecordController::CAdvancedAudioRecordController()
	:	iState(EStopped),
		iAudioInput(NULL),
		iAudioResource(NULL),
		iAudioUtility(NULL),
		iSinkWritePosition(0),
		iMaxFileSize(-1)
    {
    RThread().SetPriority(EPriorityRealTime);
    }
Example #12
0
static void CheckHandles()
    {
    TInt endProcessHandleCount;
    TInt endThreadHandleCount;
    
    RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);

    TEST2(TheProcessHandleCount, endProcessHandleCount);
    TEST2(TheThreadHandleCount, endThreadHandleCount);
    }
/**
@SYMTestCaseID		SYSLIB-ECOM-CT-0177
@SYMTestCaseDesc 	Check that IsSSA works when ecomsrvr has different values.
@SYMTestPriority 	High
@SYMTestActions  	Check that IsSSA returns ETrue when ecomsrvr ini does not exist.
                    Check that IsSSA returns the value in the ecomsrvr ini file when
                    the file exists.
@SYMTestExpectedResults The test must not fail.
@SYMPREQ PREQ967
*/
void IsSsa_TestL()
	{
	TInt processHandlesS = 0;
	TInt threadHandlesS = 0;
	TInt processHandlesE = 0;
	TInt threadHandlesE = 0;
	RThread().HandleCount(processHandlesS, threadHandlesS);

	TBool res;

	TestEnableDisableSsaL(TheTest, TheFs);

    /*****************************************************************/
	//test that IsSSA() returns ETrue when ecomsrvr.ini file does
	//not exist.

	//enable ssa
	EnableSsa(TheTest, TheFs);

	//test that IsSSA() returns ETrue
	CEComServer* server=CEComServer::NewLC();
	res = server->IsSSA(TheFs);
	CleanupStack::PopAndDestroy();
	ResetSsa(TheTest, TheFs);
	TEST(res);

    /*****************************************************************/
	//test that IsSSA() returns EFalse when ecomsrvr.ini file exists.

	//disable ssa
	DisableSsa(TheTest, TheFs);

	//test that IsSSA() returns EFalse
	server=CEComServer::NewLC();
	res = server->IsSSA(TheFs);
	CleanupStack::PopAndDestroy();
	ResetSsa(TheTest, TheFs);
	TEST(!res);

	RThread().HandleCount(processHandlesE, threadHandlesE);
	TEST(processHandlesS == processHandlesE);
	TEST(threadHandlesS == threadHandlesE);
	}
void CStsServerSession::DoRegisterMsgQueueL(const RMessage2& aMessage)
    {
    TInt result = iMsgQueue.Open(aMessage, 0);
    if (result == KErrNone)
        {
        TThreadId id = RThread().Id();
        TPckg<TThreadId> idPckg(id);
        TRAP(result,aMessage.Write(1, idPckg));
        }
    aMessage.Complete(result);
    }
TInt CTestStep_MMF_A2DPBLUETOOTH_SVR_U_0020::NewThread(TAny* aTestStep) 
	{
	CTestStep_MMF_A2DPBLUETOOTH_SVR_U_0020* testStep = reinterpret_cast<CTestStep_MMF_A2DPBLUETOOTH_SVR_U_0020*>(aTestStep);

	//install active scheduler for new thread
	CActiveScheduler* activeScheduler=NULL;
	activeScheduler=new(ELeave) CActiveScheduler;
	CActiveScheduler::Install(activeScheduler);
	CTrapCleanup* cleanup = CTrapCleanup::New();
	if(cleanup == NULL)
		{
		return KErrNoMemory;
		}
		
	RA2dpBTHeadsetAudioInterface aThread2A2dpBTHeadsetAudioInterface;
	TInt err = aThread2A2dpBTHeadsetAudioInterface.Connect();
	if (err)
		{
		return err;
		}
	
	CAsyncTestStepNotifier* asyncRequestHandler = NULL;
	TRAP(err,asyncRequestHandler = CAsyncTestStepNotifier::NewL(testStep));
	if (err)
		{
		return err;
		}
	TRequestStatus* status = &(asyncRequestHandler->RequestStatus());
	testStep->iError = KErrGeneral;
	//this initialize should complete much faster than the Initialize in the main thread
	aThread2A2dpBTHeadsetAudioInterface.Initialize(*testStep->iBTheadsetAddress, *status);
	asyncRequestHandler->HandleAsyncRequest();
	
	if (!testStep->iError)
		{
		//a better test would set the sample rate to a different one to that in 
		//the main thread forcing a reconfigure - but reconfiguring doesn't
		//work in GAVDP_Open on blueant headset
		err = aThread2A2dpBTHeadsetAudioInterface.SetSampleRate(KDefaultTestSampleRate);
		if (!err)
			{
			testStep->iError = KErrGeneral;
			aThread2A2dpBTHeadsetAudioInterface.OpenDevice(*status);
			asyncRequestHandler->HandleAsyncRequest();
			}
		aThread2A2dpBTHeadsetAudioInterface.Close();
		}
		
	delete activeScheduler;
	delete cleanup;
	delete asyncRequestHandler;
	RThread().Kill(KErrNone);
	return KErrNone;
	}
Example #16
0
void CAsyncTest::ConstructL()
	{	
	TPtrC name(RThread().Name());
	iTest = new(ELeave) RTest(name);	
	iTest->Start(_L("T_CAsyncTest"));
	CreateNamedDbL();
	TRequestStatus *pS = &iStatus;
	User::RequestComplete(pS, KErrNone);
	SetActive();
	CActiveScheduler::Start();
	}
/**
@SYMTestCaseID          SYSLIB-ECOM-CT-0756
@SYMTestCaseDesc	    OOM Test for create and delete of CBackUpNotifier
@SYMTestPriority 	    High
@SYMTestActions  	    Check for handle leak after deletion of object.
@SYMTestExpectedResults The test must not fail.
@SYMREQ                 REQ0000
*/
LOCAL_C void OOMCreateDeleteTest()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0756 OOM CreateDeleteTest "));
	TInt err;
	TInt failAt = 1;
	__UNUSED_VAR(failAt);

	CBackUpNotifierTest* theTest = NULL;

	do
		{
		__UHEAP_MARK;
  		// find out the number of open handles
		TInt startProcessHandleCount;
		TInt startThreadHandleCount;
		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);

		__UHEAP_SETFAIL(RHeap::EDeterministic, failAt++);

		TRAP(err, theTest = CBackUpNotifierTest::NewL());

		__UHEAP_SETFAIL(RHeap::ENone, 0);

		delete theTest;
		theTest = NULL;

		// check that no handles have leaked
		TInt endProcessHandleCount;
		TInt endThreadHandleCount;
		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);

		test(startProcessHandleCount == endProcessHandleCount);
		test(startThreadHandleCount  == endThreadHandleCount);

		__UHEAP_MARKEND;
		}
	while(err == KErrNoMemory);

	test.Printf(_L("- Succeeded at heap failure rate of %i\n"), failAt);
	test(err == KErrNone);
	}
    void CUT_PBASE_T_USBDI_1231::ConstructL()
        {
        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_ENTRY, this );
        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231, "====> Constructor entry priority = %d", RThread().Priority());

        // Collect existing thread priority (to reinstate later)
        iPriority = RThread().Priority();

        iTestDevice = new RUsbDeviceA(this);
        BaseConstructL();
        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_EXIT, this );
        }
Example #19
0
/**
Wrapper function to call all test functions
@param		aTestFunctionL pointer to test function
@param		aTestDesc test function name
*/
LOCAL_C void DoBasicTestL(ClassFuncPtrL aTestFunctionL, const TDesC& aTestDesc)
{
    TheTest.Next(aTestDesc);
    __UHEAP_MARK;
    // find out the number of open handles
    TInt startProcessHandleCount;
    TInt startThreadHandleCount;
    RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);

    aTestFunctionL();

    // check that no handles have leaked
    TInt endProcessHandleCount;
    TInt endThreadHandleCount;
    RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);

    TESTL(startProcessHandleCount == endProcessHandleCount);
    TESTL(startThreadHandleCount  == endThreadHandleCount);

    __UHEAP_MARKEND;
}
//
// MainL
//
// Create the engine and the communications interface and start the active scheduler
//
void MainL()
{
	RProcess().SetPriority(EPriorityHigh);
	RThread().SetPriority(EPriorityAbsoluteHigh);
	
	TInt sid = RProcess().SecureId();
		
	//TrkIO->PrintToScreen(_L("Welcome to TrkServer for Trk\r\n"));
	//TrkIO->PrintToScreen(_L("Press 'Q' to quit.\r\n\r\n"));

	CActiveScheduler::Start();
}
/**
 * Loop Function which validates the contact views after each CRUD operation is performed in the main thread
 */
void CContactViews::RunTestL()
	{
	// Suspend the current thread, will be resumed at a later stage by the main thread at the
	// end of each CRUD Operation
	iSemaphore.Signal();
	RThread().Suspend();
	

	while (!ExecutionCompleted())
		{
		TContactViewValidationData actualValidationData;
		SetCurrentOperation(actualValidationData);
		CContactViewEventQueue& desiredViewObserver = ViewCollectionReference().RetrieveDesiredViewObserverL(TestStepReference());
		ListenForContactViewEvents(desiredViewObserver, actualValidationData);
		TInt viewCount = iContactView->CountL();
		actualValidationData.SetViewCount(viewCount);		
		iActualData.AppendL(actualValidationData);
		iSemaphore.Signal();
		RThread().Suspend();
		}

	for(TInt i = 0; i < iExpectedData.Count(); ++i)
		{
		TContactViewValidationData::TContactViewCurrentOperation currentOperation = iExpectedData[i].CurrentOperation();
		TContactViewValidationData actualResult = RetrieveValidationData(currentOperation);
		TBool result = Compare(iExpectedData[i], actualResult);
		if(!result)
			{ 
			PrintDetailsL(iExpectedData[i], actualResult);									
			const TInt KNullCount = 0;
			if(actualResult.ViewCount() == KNullCount)
				{
				return;
				}
			_LIT(KValidationFailed, "The actual data doesnt match with the expected data");
			TestStepReference().ERR_PRINTF1(KValidationFailed);
			TestStepReference().SetTestStepResult(EFail);
			} 
		}
	}
/**
Wrapper function to call all OOM test functions
@param		testFuncL pointer to OOM test function
@param		aTestDesc test function name
*/
LOCAL_C void DoOOMTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc)
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0758 "));
	test.Next(aTestDesc);

	TInt err;
	TInt tryCount = 0;
	do
		{
		__UHEAP_MARK;
  		// find out the number of open handles
		TInt startProcessHandleCount;
		TInt startThreadHandleCount;
		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);

		CBackUpNotifierTest* theTest = CBackUpNotifierTest::NewL();
		CleanupStack::PushL(theTest);

		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);

		TRAP(err, (theTest->*testFuncL)());

		__UHEAP_SETFAIL(RHeap::ENone, 0);

		CleanupStack::PopAndDestroy(theTest);
		theTest = NULL;
		// check that no handles have leaked
		TInt endProcessHandleCount;
		TInt endThreadHandleCount;
		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);

		test(startProcessHandleCount == endProcessHandleCount);
		test(startThreadHandleCount  == endThreadHandleCount);

		__UHEAP_MARKEND;
		} while(err == KErrNoMemory);

	test(err == KErrNone);
	test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
	}
Example #23
0
TBMSpawnArgs::TBMSpawnArgs(TThreadFunction aChildFunc, TInt aChildPrio, TBool aRemote, TInt aSize)
	{
	iMagic = KMagic;
	iParentId = RThread().Id();
		// get a thread handle meaningful in the context of any other thread. 
		// (RThread() doesn't work since contextual!)
	TInt r = iParent.Open(iParentId);
	BM_ERROR(r, r == KErrNone);
	iRemote = aRemote;
	iChildFunc = aChildFunc;
	iChildPrio = aChildPrio;
	iSize = aSize;
	}
Example #24
0
 ~QSymbianPrintExitInfo()
 {
     RProcess myProc;
     TFullName fullName = myProc.FileName();
     TInt cells = User::CountAllocCells();
     TInt processHandleCount=0;
     TInt threadHandleCount=0;
     RThread().HandleCount(processHandleCount, threadHandleCount);
     RDebug::Print(_L("%S exiting with %d allocated cells, %d handles"),
                   &fullName,
                   cells - initCells,
                   (processHandleCount + threadHandleCount) - (initProcessHandleCount + initThreadHandleCount));
 }
Example #25
0
/**
@SYMTestCaseID				PIM-APPENG-CNTMODEL-EC021-CIT-0010
@SYMTestCaseDesc			Resource leak test
@SYMTestType				CIT
@SYMTestPriority			High
@SYMTestActions				Repeat all the previous test cases in an OOM test and check for handle leaks. 
@SYMTestExpectedResults		No memory leaks or handle leaks should occur.
@SYMTestStatus				Implemented
@SYMTestCaseDependencies	Plug-in implementation must exist
@SYMEC						EC021 Break dependency of Log engine (Syslibs/Logeng) on Contacts model (App-engines/Cntmodel)
*/
LOCAL_C void OomTest(void (*testFuncL)(void))
	{	
	TInt error;
	TInt count = 0;
	OomTesting = ETrue;

	do
		{
		User::__DbgSetAllocFail(RHeap::EUser, RHeap::EFailNext, ++count);
		User::__DbgMarkStart(RHeap::EUser);
		
  		// find out the number of open handles
		TInt startProcessHandleCount;
		TInt startThreadHandleCount;
		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
		
		TRAP(error, (testFuncL)());
		
		// check that no handles have leaked
		TInt endProcessHandleCount;
		TInt endThreadHandleCount;
		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
		
		TEST2(endProcessHandleCount, startProcessHandleCount);
		TEST2(endThreadHandleCount, startThreadHandleCount);
		
		User::__DbgMarkEnd(RHeap::EUser, 0);
		} while(error == KErrNoMemory);

	_LIT(KTestFailed, "Out of memory test failure on iteration %d\n");
	__ASSERT_ALWAYS(error==KErrNone, theTest.Panic(error, KTestFailed, count));

	// Reset alloc fail
	User::__DbgSetAllocFail(RHeap::EUser, RHeap::ENone, 1);
	
	theTest.Printf(_L("OOM testing succeeded at heap failure rate of %d\n"), count);
	OomTesting = EFalse;
	}
void NewLC_OOMTestL()
	{
	TInt processHandlesS = 0;
	TInt threadHandlesS = 0;
	TInt processHandlesE = 0;
	TInt threadHandlesE = 0;
	RThread().HandleCount(processHandlesS, threadHandlesS);
	for(TInt count=1;;count +=100)
		{
		// Setting Heap failure for OOM test
		__UHEAP_SETFAIL(RHeap::EDeterministic, count);
		__UHEAP_MARK;

		CEComServer* ecomServer = NULL;
		TRAPD(err, ecomServer = CEComServer::NewLC();
				   CleanupStack::PopAndDestroy(ecomServer));
		if(err == KErrNoMemory)
			{
			__UHEAP_MARKEND;
			}
		else if(err == KErrNone)
			{
			__UHEAP_MARKEND;
			RDebug::Print(_L("The test succeeded at heap failure rate=%d.\n"), count);
			break;
			}
		else
			{
			__UHEAP_MARKEND;
			TEST2(err, KErrNone);
			}
		__UHEAP_RESET;
		}
	__UHEAP_RESET;
	RThread().HandleCount(processHandlesE, threadHandlesE);
	TEST(processHandlesS == processHandlesE);
	TEST(threadHandlesS == threadHandlesE);
	}
void CVideoBufferSinkHandler::ConstructL(OMX_SYMBIAN_PARAM_3PLANE_CHUNK_DATA& aChunkDataMsg, const OMX_SYMBIAN_PARAM_BUFFER_SIZE& aBufferSize, OMX_PARAM_PORTDEFINITIONTYPE& portDef)
    {
    iBufferChunk.SetHandle(aChunkDataMsg.nChunk);
    User::LeaveIfError(iBufferChunk.Duplicate(RThread()));
       
    iReceiveBuffer.SetHandle(aChunkDataMsg.nFilledBufferQueue );
    User::LeaveIfError(iReceiveBuffer.Duplicate(RThread()));
       
    iSendBuffer.SetHandle(aChunkDataMsg.nAvailableBufferQueue); 
    User::LeaveIfError(iSendBuffer.Duplicate(RThread()));
    
   	if (portDef.nBufferCountActual <= 0 || portDef.nBufferSize <= 0)
		{
		User::Leave(KErrArgument);
		}
	
	iBufConfig.iNumBuffers = portDef.nBufferCountActual;
	iBufConfig.iBufferSizeInBytes = aBufferSize.nBufferSize;
	
	// Open datafile
	User::LeaveIfError(iFs.Connect());
	User::LeaveIfError(iFileSink.Replace(iFs, iFileName, EFileShareExclusive|EFileWrite));
	}
Example #28
0
void TRecursiveMutex::Acquire()
{
    TThreadId id = RThread().Id();
    if (iOwner == id)
    {
        ++iCount;
    }
    else
    {
        iMutex.Wait();
        iCount = 1;
        iOwner = id;
    }
}
Example #29
0
void Proxy::Hide()
{
    qDebug()<<"Proxy::Hide"<<RThread().Id().Id();
/*
    RThread t;
    TThreadId id(App->thrID);
    qDebug()<<"err:"<<t.Open(id,EOwnerProcess);
    qDebug()<<"resume in proxy:"<<t.Id().Id();
    t.Resume();
    t.Close();
*/
    emit sigHide();
//QMetaObject::invokeMethod(App, "Hide", Qt::QueuedConnection);
}
Example #30
0
LOCAL_D void doTestsL()
	{
	theTest.Start(_L("@SYMTESTCaseID:PIM-T-LOGCNTMODEL-0001 Test contact matching plugin"));

	
	TInt startProcessHandleCount;
	TInt startThreadHandleCount;
	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
	
	CActiveScheduler *testScheduler = new (ELeave) CActiveScheduler;
	CleanupStack::PushL( testScheduler );
	CActiveScheduler::Install( testScheduler );
	
	// Test main plugin functionality
	theTest.Next(_L("Test contacts plugin functionality"));

	TestContactMatchingPluginL();
	
	// OOM test main plug-in functionality
	theTest.Next(_L("OOM test contacts plugin functionality"));

	OomTest(TestContactMatchingPluginL);
	
	// Perform plugin performance measurements - no benchmark testing
	theTest.Next(_L("Test contacts matching plugin performance"));

	PerformanceTestContactMatchingPluginL();
		
	CleanupStack::PopAndDestroy(); // Scheduler,
	testScheduler = NULL;
	
	TInt endProcessHandleCount;
	TInt endThreadHandleCount;
	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
	TEST2(endProcessHandleCount, startProcessHandleCount);
	TEST2(endThreadHandleCount, startThreadHandleCount);
	}