Example #1
0
LOCAL_D void SwitchToMainThread(RMutex& aMutex)
    {    
    RThread::Rendezvous(KErrNone);         
    aMutex.Wait();     
    aMutex.Signal();
    User::After(10);
    }
Example #2
0
void Wait()
	{
	RMutex syncMutex;
	if(syncMutex.OpenGlobal(KSyncMutext)!=KErrNone)
		User::Invariant();
	syncMutex.Wait();
	syncMutex.Signal();
	syncMutex.Close();
	}
Example #3
0
 QWaitConditionPrivate()
 : waiters(0), wakeups(0)
 {
     qt_symbian_throwIfError(mutex.CreateLocal());
     int err = cond.CreateLocal();
     if (err != KErrNone) {
         mutex.Close();
         qt_symbian_throwIfError(err);
     }
 }
Example #4
0
/* Unlock the mutex */
int SDL_mutexV(SDL_mutex *mutex)
{
	if ( mutex == NULL ) {
		SDL_SetError("Passed a NULL mutex");
		return -1;
	}
	RMutex rmutex;
    rmutex.SetHandle(mutex->handle);
	rmutex.Signal();
	return(0);
}
Example #5
0
void LockLeave(void* Handle)
{
	lock_t *lock = (lock_t *)Handle;
    if (lock && --lock->Counter == 0)
    {
        lock->Thread = 0;
    	RMutex p;
	    p.SetHandle(lock->Handle);
	    p.Signal();
    }
}
Example #6
0
void LockDelete(void* Handle)
{
	lock_t *lock = (lock_t *)Handle;
    if (lock)
    {
	    RMutex p;
	    p.SetHandle(lock->Handle);
	    p.Close();
        free(lock);
    }
}
Example #7
0
bool_t ConditionWait(void* Handle,int Tick,void* Lock)
{
	RCondVar p;
	RMutex m;	
	p.SetHandle((int)Handle);
	m.SetHandle((int)Lock);
	// Increase the tick by one to mimic other platforms
	// which is -1 = Wait forever, 0 = Return
	// For Symbian, 0 = Wait forever
	Tick++;		
	return p.TimedWait(m, Tick*1000) == KErrNone;
}
Example #8
0
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
{
	if ( mutex ) 
	{
    RMutex rmutex;
    rmutex.SetHandle(mutex->handle);
	rmutex.Signal();
	rmutex.Close();
	delete(mutex);
    mutex = NULL;
	}
}
Example #9
0
void* LockCreate()
{
	lock_t *lock = (lock_t *)malloc(sizeof(lock_t));
    if (lock)
    {
	    RMutex p;
	    p.CreateLocal();
        lock->Handle = p.Handle();
        lock->Counter = 0;
        lock->Thread = 0;
    }
	return lock;
}
Example #10
0
/* Create a mutex */
SDL_mutex *SDL_CreateMutex(void)
{
    RMutex rmutex;

    TInt status = CreateUnique(NewMutex, &rmutex, NULL);
	if(status != KErrNone)
	    {
			SDL_SetError("Couldn't create mutex");
		}
    SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
    mutex->handle = rmutex.Handle();
	return(mutex);
}
Example #11
0
GLDEF_C TInt E32Main()
    {
	TBuf16<512> cmd;
	User::CommandLine(cmd);
	if(cmd.Length() && TChar(cmd[0]).IsDigit())
		{
		TInt function = -1;
		TInt arg1 = -1;
		TInt arg2 = -1;
		TLex lex(cmd);

		lex.Val(function);
		lex.SkipSpace();
		lex.Val(arg1);
		lex.SkipSpace();
		lex.Val(arg2);
		return DoTestProcess(function,arg1,arg2);
		}

	test.Title();

	if((!PlatSec::ConfigSetting(PlatSec::EPlatSecProcessIsolation))||(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement)))
		{
		test.Start(_L("TESTS NOT RUN - PlatSecProcessIsolation is not enforced"));
		test.End();
		return 0;
		}

	test(SyncMutex.CreateGlobal(KSyncMutext)==KErrNone);
	
	test.Start(_L("Test SetJustInTime"));
	TestSetJustInTime();

	test.Next(_L("Test Rename"));
	TestRename();

	test.Next(_L("Test Kill, Panic and Teminate"));
	TestKill();

	test.Next(_L("Test Resume"));
	TestResume();

	test.Next(_L("Test SetPriority"));
	TestSetPriority();


	SyncMutex.Close();
	test.End();

	return(0);
    }
Example #12
0
/* Create a mutex */
SDL_mutex *SDL_CreateMutex(void)
{
    RMutex rmutex;

    TInt status = CreateUnique(NewMutex, &rmutex, NULL);
	if(status != KErrNone)
	    {
			SDL_SetError("Couldn't create mutex");
		}
    SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex;
    mutex->handle = rmutex.Handle();
    EpocSdlEnv::AppendCleanupItem(TSdlCleanupItem(DeleteMutex, mutex));
	return(mutex);
}
Example #13
0
    bool wait(unsigned long time)
    {
        TInt err = KErrNone;
        if (time == ULONG_MAX) {
            // untimed wait, loop because RCondVar::Wait may return before the condition is triggered
            do {
                err = cond.Wait(mutex);
            } while (err == KErrNone && wakeups == 0);
        } else {
            unsigned long maxWait = KMaxTInt / 1000;
            QElapsedTimer waitTimer;
            do {
                waitTimer.start();
                unsigned long waitTime = qMin(maxWait, time);
                // wait at least 1ms, as 0 means no wait
                err = cond.TimedWait(mutex, qMax(1ul, waitTime) * 1000);
                // RCondVar::TimedWait may return before the condition is triggered, update the timeout with actual wait time
                time -= qMin((unsigned long)waitTimer.elapsed(), waitTime);
            } while ((err == KErrNone && wakeups == 0) || (err == KErrTimedOut && time > 0));
        }

        Q_ASSERT_X(waiters > 0, "QWaitCondition::wait", "internal error (waiters)");
        --waiters;
        if (err == KErrNone) {
            Q_ASSERT_X(wakeups > 0, "QWaitCondition::wait", "internal error (wakeups)");
            --wakeups;
        }

        mutex.Signal();

        if (err && err != KErrTimedOut)
            report_error(err, "QWaitCondition::wait()", "cv wait");
        return err == KErrNone;
    }
Example #14
0
/* Free the mutex */
void SDL_DestroyMutex(SDL_mutex *mutex)
{
	if ( mutex ) 
	{
    RMutex rmutex;
    rmutex.SetHandle(mutex->handle);
    if(rmutex.IsHeld())
        {
	    rmutex.Signal();
        }
	rmutex.Close();
	EpocSdlEnv::RemoveCleanupItem(mutex);
	delete(mutex);
    mutex = NULL;
	}
}
Example #15
0
// --------------------------------------------------------------------------------
// void DumpToFileL( TPtrC8 aBuffer )
// --------------------------------------------------------------------------------
void DumpToFileL( TPtrC8 aBuffer )
	{
	RFs fileSession;
	TInt pushed(0);
	if( fileSession.Connect() == KErrNone )
		{
		CleanupClosePushL(fileSession);
		pushed++;
		RFile file;
#ifdef __WINS__
		if( file.Open(fileSession, KNSmlDebugOutputName(), EFileShareAny|EFileWrite) == KErrNone )
#else
		HBufC* outputName = HBufC::NewLC( KNSmlDebugOutputName().Length()+1 );
		pushed++;
		TPtr namePtr = outputName->Des();
		TDriveInfo driveInfo;
		for ( TUint driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ ) 
			{
			fileSession.Drive( driveInfo, driveNumber );
			if ( KDriveAttRemovable & driveInfo.iDriveAtt ) 
				{
				// this is MMC
				namePtr.Insert( 0, KNSmlDebugDriveLetters().Mid( driveNumber, 1 ));
				namePtr.Insert( 1, KNSmlDebugOutputName() );
				break;
				}
			}
		if( file.Open(fileSession, *outputName, EFileShareAny|EFileWrite) == KErrNone )
#endif

			{
			CleanupClosePushL(file);
			TInt pos(0);
			file.Seek(ESeekEnd, pos);
			RMutex mutex;
			NSmlGrabMutexLC(mutex, KNSmlDebugMutexName());
			TInt result = file.Write(aBuffer);
			TInt result2 = file.Flush();
			mutex.Signal();
			CleanupStack::PopAndDestroy(2); // file, mutex
			User::LeaveIfError(result);
			User::LeaveIfError(result2);
			}
		CleanupStack::PopAndDestroy( pushed ); // fileSession and (for target) outputName
		}
	}
Example #16
0
void TRecursiveMutex::Release()
{
    if (--iCount == 0)
    {
        iOwner = 0;
        iMutex.Signal();
    }
}
Example #17
0
TInt Thread3(TAny* a)
{
    SThreadData2& d = *(SThreadData2*)a;
    RMutex m;
    RCondVar cv;
    TInt r = m.OpenGlobal(TPtrC(d.iMutexName), EOwnerThread);
    if (r!=KErrNone)
        return r;
    r = cv.OpenGlobal(TPtrC(d.iCondVarName), EOwnerThread);
    if (r!=KErrNone)
        return r;
    m.Wait();
    while (r==KErrNone)
    {
        r = cv.Wait(m);
        ++d.iInnerLoops;
    }
    return r;
}
Example #18
0
LOCAL_D void SwitchToWorkerThread(RMutex& aMutex, RThread& aThread, TBool aSignal, TBool aWait)
    {
    if (aSignal)
        {
        aMutex.Signal();             
        User::After(10);         
        }
        
    if (aWait)
        {            
        aMutex.Wait(); 
        }
        
    TRequestStatus status;            
    aThread.Rendezvous(status);         


    User::WaitForRequest(status);            
    }    
Example #19
0
void LockEnter(void* Handle)
{
	lock_t *lock = (lock_t *)Handle;
    if (lock)
    {
        RThread current;
        TUint currentId = current.Id();
        if (lock->Thread == currentId)
            ++lock->Counter;
        else
        {
	        RMutex p;
	        p.SetHandle(lock->Handle);
	        p.Wait();
            assert(lock->Counter==0);
            lock->Counter = 1;
            lock->Thread = currentId;
        }
    }
}
Example #20
0
TInt Thread4(TAny* a)
{
    volatile TInt& count = *(volatile TInt*)a;
    TInt r = KErrNone;
    M2.Wait();
    while (r==KErrNone)
    {
        r = CV2.Wait(M2);
        ++count;
    }
    return r;
}
Example #21
0
// --------------------------------------------------------------------------------
// void NSmlGrabMutexLC( RMutex& aMutex, const TDesC& aMutexName )
// --------------------------------------------------------------------------------
LOCAL_C void NSmlGrabMutexLC( RMutex& aMutex, const TDesC& aMutexName )
	{
	while( ETrue )
		{
		TInt ret = aMutex.CreateGlobal(aMutexName);
		if( ret == KErrNone ) // We created the mutex -> Issue wait()
			{
			aMutex.Wait();
			break;
			}
		if( ret == KErrAlreadyExists ) // Mutex already existed -> Open it
			{
			ret = aMutex.OpenGlobal(aMutexName);
			if( ret == KErrNone ) // We got handle to the mutex -> Issue wait()
				{
				aMutex.Wait();
				break;
				}
			}
		}
	CleanupClosePushL(aMutex);
	}
Example #22
0
void TRecursiveMutex::Acquire()
{
    TThreadId id = RThread().Id();
    if (iOwner == id)
    {
        ++iCount;
    }
    else
    {
        iMutex.Wait();
        iCount = 1;
        iOwner = id;
    }
}
Example #23
0
TInt CPARAM_MESS_NAMEStep::Exec_SendReceive()
	{
	_LIT(KEsockSessStartMutex,"KESSMTX"); //Keep the descriptor short
	RMutex mutex;
	TInt r;
	// Protect the openning of the session
	// with a mutex to stop thread collision
	FOREVER
		{
		r = mutex.CreateGlobal(KEsockSessStartMutex());
		if (r == KErrNone)
			break;
		if (r != KErrAlreadyExists)
			return r;
		r=mutex.OpenGlobal(KEsockSessStartMutex());
		if (r == KErrNone)
			break;
		if (r != KErrNotFound)
			return r;
		}
	mutex.Wait(); // the exclusion ensures the session is started atomically
	iResult_Server=CreateSession(SOCKET_SERVER_NAME,Version());
	// Because ESock is now loaded by the Comms Root Server which is generally started during
	// the boot this should commonly succeed; however for test code this is still a possibility
	// Hence here we try starting it; this is an atomic operation (and cheap if it's already started)
	if (iResult_Server==KErrNotFound)
		{
		r=StartC32();
		if (r==KErrNone || r==KErrAlreadyExists)
			{
			iResult_Server=CreateSession(SOCKET_SERVER_NAME,Version());
			}
		}
	mutex.Signal();
	mutex.Close();

	if (iResult_Server == KErrNone)
		{
		iSessionCreated = ETrue;

		const TInt test_id = dispatch_num<PARAM_MESS_VALUE>::result;

		iResult_SR = do_execute(Int2Type<test_id>());
		}
	else
		{
		iSessionCreated = EFalse;
		return 0;
		}
	return r;
	}
Example #24
0
TInt CCapabilityTestStep::StartServer()
	{
	TInt err = KErrNone;

    RMutex mutex;
    err = mutex.CreateGlobal(KSipServerStarterMutex);
    if (err != KErrNone)
        {
        err = mutex.OpenGlobal(KSipServerStarterMutex);
        if (err != KErrNone)
            {
            return err;
            }
        }
    mutex.Wait();
        {
        // Protected with a mutex
        TFindServer findServer(KSipServerName);
        TFullName name;
	    if (findServer.Next(name) == KErrNone)
            {
            mutex.Signal();
            mutex.Close();
            return KErrNone; // Server already running
            }

	    RSemaphore semaphore;
	    err = semaphore.CreateGlobal(KSipServerSemaphoreName,0);
	    if (err == KErrNone)
		    {
	        err = CreateServerProcess(semaphore);
	        semaphore.Close();
		    }
        }
    mutex.Signal();
    mutex.Close();

    return err;
	}
Example #25
0
/**
  
   Application invoked as part of CommandLine tests
  
   @SYMPREQ 280 File Handle Support
  
   FunctionDesc Tests Environment slots . 
   Acquires a Mutex for log file access
   Invokes EnvironmentSlotsReaderL() which returns an CApaCommandLine Object
   Verifies the values returned by the GET APIs of CApaCommandLine object with those of predefined values
   Writes "Pass" to the logfile if verification passes else "Fail" is written.
  
 */
void testEnvironmentSlotsL()
	{

	TPtrC appName;
	TPtrC docName;
	TApaCommand command = EApaCommandOpen;
	TBool testResult = PASS;
	
		
	//Get the Mutex to access the log file
	RMutex fileAccess;
	fileAccess.OpenGlobal(KTLogFileAccess);
	fileAccess.Wait();
			
	/** Invoke EnvironmenstSlotsReaderL() function which would constuct the CApaCommandLine class object
	from the environment slots and return the pointer to that object */
	//CApaCommandLine* cmdLine = CApaCommandLine::EnvironmentSlotsReaderL(); 
	
	//Method CApaCommandLine::EnvironmentSlotsReaderL has been implemented in a different fashion
	CApaCommandLine* cmdLine;
	CApaCommandLine::GetCommandLineFromProcessEnvironment(cmdLine);

	CleanupStack::PushL(cmdLine);
    				
    appName.Set(KTAppName);
	docName.Set(KTDocName);
	
	RFs fSession;
	fSession.Connect();
	RFile logFile;
	TBufC<KMaxFilePath> testFilePath(KFilePath);
	
	//Open the Log file in Write Mode			
	User::LeaveIfError(logFile.Replace(fSession,testFilePath,EFileWrite));
		
	// Compare the values returned by GET APIs with pre defined values	
	TESTCOND(appName,cmdLine->ExecutableName());
	
	if(appName != cmdLine->ExecutableName())
	{
		logFile.Write(KTFail);
		logFile.Write(KTApp);
	}
		
	TESTCOND(docName,cmdLine->DocumentName());
	if(docName != cmdLine->DocumentName())
	{
		logFile.Write(KTFail);
		logFile.Write(KTDoc);
	}
	
    TESTCOND(command,cmdLine->Command());
	
	if(command != cmdLine->Command())
	{
		logFile.Write(KTFail);
		logFile.Write(KTCommand);
	}
	          
    if(testResult == PASS)
    	{
    	logFile.Write(KTPass);
    	}
  
    	
    //Close the file and the file session
    logFile.Close();
    fSession.Close();
    
    //Signal the Mutex
    fileAccess.Signal();  
    CleanupStack::PopAndDestroy(cmdLine); 

	}
Example #26
0
// -----------------------------------------------------------------------------
// InitServerL
// Initialises the SatServer.
// -----------------------------------------------------------------------------
//
LOCAL_C void InitServerL()
    {
    LOG( SIMPLE, "SATSERVER: InitServerL calling" )

    RMutex serverStartMutex;
    TInt createErr( serverStartMutex.CreateGlobal( KSatServerMtx ) );
    if ( createErr )
        {
        TInt openErr( serverStartMutex.OpenGlobal( KSatServerMtx ) );
        User::LeaveIfError( openErr );
        LOG( SIMPLE, "SATSERVER:   Opened SATSERVERMTX" )
        }

    LOG( SIMPLE, "SATSERVER:   Asking ownership of SATSERVERMTX" )
    serverStartMutex.Wait();
    LOG( SIMPLE, "SATSERVER:   Got ownership of SATSERVERMTX" )

    // create server - if one of this name does not already exist
    TFindServer findSatServer( KSatServerName );
    TFullName pathName;

    // Search for the server.
    if ( KErrNone != findSatServer.Next( pathName ) )
        {
        // We don't already exist.
        // Start scheduler and server.
        CSatSScheduler* scheduler = new ( ELeave ) CSatSScheduler;
        __ASSERT_ALWAYS( scheduler !=
            NULL, PanicServer( ESatSMainSchedulerError ) );

        CleanupStack::PushL( scheduler );
        CActiveScheduler::Install( scheduler );

        // Rename the thread.
        User::RenameThread( KSatServerName );

        // Create the server and connect to external interfaces.
        CSatSServer* server = CreateSatServerL();
        CleanupStack::PushL( server );

        // The scheduler needs access to the server instance.
        //lint -e{613} scheduler cannot be null, due assertion in creation.
        scheduler->SetServer( server );

        // Call Rendezvous to improve startup time
        RProcess::Rendezvous( KErrNone );

        LOG( SIMPLE,
            "SATSERVER:   Releasing ownership of SATSERVERMTX, Starting.." )
        serverStartMutex.Signal();

        // start fielding requests from clients
        CActiveScheduler::Start();

        // finished when the scheduler stops
        CleanupStack::PopAndDestroy( KInitServerPop ); // scheduler, server
        }
    else
        {
        LOG( SIMPLE,
            "SATSERVER:   Releasing ownership of SATSERVERMTX, Already started" )
        serverStartMutex.Signal();
        }
    serverStartMutex.Close();
    LOG( SIMPLE, "SATSERVER: InitServerL exiting" )
    }
Example #27
0
LOCAL_D void TestSecondL(RTest& aTest)
    {
    aTest.Next(_L("-- Second Owncard Test --"));

    
    RMutex mtx;
    TInt errMutex = mtx.CreateGlobal(KOwnCardMutex);
    User::LeaveIfError(errMutex);
    CleanupClosePushL(mtx);    
    
    RThread thd;  
    aTest.Printf(_L("Creating worker thread \n"));  
    TInt errThread = thd.Create(KThreadFunc, ThreadFunction, KDefaultStackSize, KDefaultStackSize*20, KDefaultStackSize*40, NULL);  
    User::LeaveIfError(errThread);
    CleanupClosePushL(thd);
    thd.Resume();    
         
    SwitchToWorkerThread(mtx, thd, EFalse, ETrue); // a) Run: WT-start to WT-1
                  
    ///////////////////////////////////////////////
    // Worker thread has now replaced the database    
    ///////////////////////////////////////////////
        
    aTest.Printf(_L("Open existing database \n"));
    CContactDatabase* db = CContactDatabase::OpenL(KDatabaseFileName);
    CleanupStack::PushL(db);
        
    SwitchToWorkerThread(mtx, thd, ETrue, ETrue); // b) Run: WT-1 to WT-2                    
    
    ///////////////////////////////////////////////
    // Worker thread has now added the contacts
    ///////////////////////////////////////////////
        
    WaitForNotificationsL(db); 
    
    aTest.Printf(_L("Checking db count \n"));          
    TInt count = db->CountL();
    aTest.Printf(_L("Count: %d \n"), count);
    aTest(count == KTotalContacts, __LINE__);
    
    aTest.Printf(_L("Checking owncard id \n"));      
    TContactItemId id = db->OwnCardId();  
    aTest.Printf(_L("id: %d \n"), id);
    aTest(id != KNullContactId, __LINE__);
    
    SwitchToWorkerThread(mtx, thd, ETrue, ETrue); // c) Run: WT-2 to WT-3      
    
    ///////////////////////////////////////////////
    // Worker thread has now deleted the contacts
    ///////////////////////////////////////////////
    
    aTest.Printf(_L("Checking deleted db count \n"));      
        
    WaitForNotificationsL(db); 
    
    count = db->CountL();
    aTest.Printf(_L("Count: %d \n"), count);
    aTest(count == 0, __LINE__);
    
    aTest.Printf(_L("Checking deleted owncard id \n"));      
    id = db->OwnCardId();  
    aTest.Printf(_L("id: %d \n"), id);
    aTest(id == KNullContactId, __LINE__);
                 
    CleanupStack::PopAndDestroy(db);           
        
    SwitchToWorkerThread(mtx, thd, ETrue, EFalse); // d) Run: WT-3 to end
    
    CleanupStack::PopAndDestroy(); // close thd handle
    CleanupStack::PopAndDestroy(); // close mtx handle        
    }
Example #28
0
LOCAL_D void ThreadFirstTestL(RTest& aTest)
    {
    aTest.Next(_L("-- Running worker thread --"));


    RMutex mutex;
    TInt errMutex = mutex.OpenGlobal(KOwnCardMutex);   
    User::LeaveIfError(errMutex);
    CleanupClosePushL(mutex);
    
    aTest.Printf(_L("Replacing the database \n"));
    CContactDatabase* db = CContactDatabase::ReplaceL(KDatabaseFileName);
    CleanupStack::PushL(db); 
    
    // get a second database object
    CContactDatabase* dbAnother = CContactDatabase::OpenL(KDatabaseFileName);
    CleanupStack::PushL(dbAnother);    
        
    SwitchToMainThread(mutex); // 1) Back to MT-a
    
    ///////////////////////////////////////////////
    // Main thread has now opened the database    
    ///////////////////////////////////////////////
                        
    aTest.Printf(_L("Populating the database \n"));
    PopulateDatabaseL(db, KTotalContacts);    
    WaitForNotificationsL(db);        
                    
    aTest.Printf(_L("Set the Own card id \n"));                    
    TestSetOwnCardL(db);                
    WaitForNotificationsL(db);
    
    aTest.Printf(_L("Checking count value \n"));
    TInt count = db->CountL();    
    TInt countAnother = dbAnother->CountL();
    aTest.Printf(_L("Count: %d \n"), count );
    aTest(count == KTotalContacts && countAnother == KTotalContacts, __LINE__);
    
    aTest.Printf(_L("Checking the id \n"));
    TContactItemId id = db->OwnCardId();
    TContactItemId idCopy = dbAnother->OwnCardId();
    aTest.Printf(_L("Id: %d \n"), id);    
    aTest(id != KNullContactId && idCopy != KNullContactId, __LINE__);                
        
    SwitchToMainThread(mutex); // 2) Back to MT-b 
    
    ///////////////////////////////////////////////
    // Main thread has now checked the added values    
    ///////////////////////////////////////////////    
    
    DeleteMultipleContactsL(db);    
    WaitForNotificationsL(db);         
        
    aTest.Printf(_L("Checking deleted count value \n"));
    count = db->CountL();
    countAnother = dbAnother->CountL();    
    aTest.Printf(_L("Count: %d \n"), count );
    aTest(count == 0 && countAnother == 0, __LINE__);
    
    aTest.Printf(_L("Checking the deleted id \n"));
    id = db->OwnCardId();
    idCopy = dbAnother->OwnCardId();
    aTest.Printf(_L("Id: %d \n"), id);    
    aTest(id == KNullContactId && idCopy == KNullContactId, __LINE__);
            
    SwitchToMainThread(mutex); // 3) Back to MT-c
    
    ///////////////////////////////////////////////
    // Main thread has now checked the deleted values    
    ///////////////////////////////////////////////    
    
    CleanupStack::PopAndDestroy(dbAnother);        
    CleanupStack::PopAndDestroy(db);
    CleanupStack::PopAndDestroy(); // close mutex handle
                
    RThread::Rendezvous(KErrNone); // Finish) back to MT-d
    }          
Example #29
0
 ~QWaitConditionPrivate()
 {
     cond.Close();
     mutex.Close();
 }
/**
Releases the mutex if leave occurs between wait and signal.
@internalTechnology
*/
void CTzLocalizationDbAccessor::ReleaseMutex(TAny *target)
{
	RMutex *mutex = static_cast<RMutex*> (target) ;	
	mutex->Signal() ;	
}