예제 #1
0
void CSharedQueueSrv::ThreadMainL()
	{
	if (!Processes::RenameIfNotRunning(KSharedQueueSrvName))
		{
		// non dovrebbe mai accadere perche' il client non dovrebbe lanciarlo se c'e' gia' un server in esecuzione...
		RSemaphore semaphore;
		User::LeaveIfError(semaphore.OpenGlobal(KSharedQueueSrvImg));
		semaphore.Signal();
		semaphore.Close();
		return;
		}
	CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler();
	CleanupStack::PushL(activeScheduler);

	CActiveScheduler::Install(activeScheduler);

	CSharedQueueSrv::NewLC();
	//
	// Initialisation complete, now signal the client
	RSemaphore semaphore;
	User::LeaveIfError(semaphore.OpenGlobal(KSharedQueueSrvImg));

	semaphore.Signal();
	semaphore.Close();

	CActiveScheduler::Start();

	CleanupStack::PopAndDestroy(2);
	}
예제 #2
0
LOCAL_C TInt clientThreadEntryPoint(TAny *param)
//
// The entry point for the client thread.
//
	{
	RSemaphore svrSem2;
	RSemaphore clientSem;
	TInt r = clientSem.OpenGlobal(KClientSemName);
	if (r != KErrNone)
		return r;
	RMySessionBase t;
	RMySessionBase t2;
//	RTimer rt[40];
//	TUint c;

	switch ((TUint32)param)
		{
	case 1:
		r=t.Open();
		if (r != KErrNone)
			break;
		clientSem.Signal();
		clientSem.Close();
		FOREVER
			;
	case 2:
		// Now create a lot of timers to eliminate kernel granularities
/*		for (c=0;c<40;c++)
			{
			TInt r=rt[c].CreateLocal();
			test(r==KErrNone);
			}
		for (c=0;c<39;c++)
			rt[c].Close();
*/
		r=svrSem2.OpenGlobal(KSvrSem2Name);
		if (r != KErrNone)
			break;
		clientSem.Signal();
		svrSem2.Wait();
		svrSem2.Close();
		User::After(2000000);
		r=t2.Open();
		if (r != KErrNone)
			break;
		r=t2.NeverComplete(); // r should be KErrServerTerminated
		if (r != KErrServerTerminated)
			break;
		t2.Close();
		clientSem.Signal();
		clientSem.Close();
		FOREVER
			;
	default:
		break;
		}
	return r;
	}
예제 #3
0
void CConcurrentDatabaseAccessBase::CloseSemaphore()
	{
	if (iSemaphoreOpen)
		{
		iSemaphoreSignal.Close();
		iSemaphoreWait.Close();
		}

	iSemaphoreOpen = EFalse;
	}
예제 #4
0
/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/  
void CExPolicy_Server::ThreadFunctionL()
    {
    // Construct active scheduler
    CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
    CleanupStack::PushL(activeScheduler) ;

    // Install active scheduler
    // We don't need to check whether an active scheduler is already installed
    // as this is a new thread, so there won't be one
    CActiveScheduler::Install(activeScheduler);

    // Construct our server
    CExPolicy_Server::NewLC();    // anonymous

	RSemaphore semaphore;
	User::LeaveIfError(semaphore.OpenGlobal(KExapmpleServerSemaphoreName));

	// Semaphore opened ok
	semaphore.Signal();
	semaphore.Close();

	// Start handling requests
	CActiveScheduler::Start();

    CleanupStack::PopAndDestroy(2, activeScheduler);    //  anonymous CSALockServer
    }
/**
* Modifier Thread entry point
*/
GLDEF_C TInt RunModifierThread(TAny* aArgs)
    {
	TInt err;
	CTestCalInterimApiModifier* modifierThread = NULL;
	CTrapCleanup* trapCleanup = CTrapCleanup::New();
	CTestStep* iTestStep = static_cast<CTestStep*>(aArgs);
	CActiveScheduler*	scheduler = new(ELeave) CActiveScheduler;

	if (scheduler)
		{
		CActiveScheduler::Install(scheduler);
    	TRAP(err, modifierThread = CTestCalInterimApiModifier::NewL(iTestStep));

    	if (err == KErrNone)
			{
			TRAP(err, modifierThread->RunTestsL());
			}
 		RSemaphore semaphoreStop;
		const TPtrC& semaphoreName = modifierThread->ModifierSemaphoreName();
		semaphoreStop.OpenGlobal(semaphoreName);

		delete modifierThread;
		modifierThread = NULL;
		delete scheduler;
		scheduler = NULL;
		delete trapCleanup;
		trapCleanup = NULL;
		
		semaphoreStop.Signal();
		semaphoreStop.Close();
		}
	
	return err;
	}
/**
 * The Contact Views thread entry point
 * @param aArgs - Command line parameters for the contact views thread
 * @return TInt - exit reason
 */
GLDEF_C TInt RunContactViewsThreadL(TAny* aArgs)
    {
	TInt err;
	CContactViews* contactViews = NULL;
	CTrapCleanup* trapCleanup = CTrapCleanup::New();
	CTestStep* testStep = static_cast<CTestStep*>(aArgs);
	CActiveScheduler*	scheduler = new(ELeave) CActiveScheduler;

	if (scheduler)
		{
		CActiveScheduler::Install(scheduler);
    	TRAP(err, contactViews = CContactViews::NewL(*testStep));

    	if (err == KErrNone)
			{
			TRAP(err, contactViews->RunTestL());
			}

		RSemaphore semaphoreStop;
		semaphoreStop.OpenGlobal(KSemaphoreName);

		delete contactViews;
		contactViews = NULL;
		delete scheduler;
		scheduler = NULL;
		delete trapCleanup;
		trapCleanup = NULL;

		semaphoreStop.Signal();
		semaphoreStop.Close();
		}

	return err;
	}
LOCAL_C void MainL()
/**
 * REQUIRES semaphore to sync with client as the Rendezvous()
 * calls are not available
 */
	{
	CActiveScheduler* sched=NULL;
	sched=new(ELeave) CActiveScheduler;
	CleanupStack::PushL(sched);
	CActiveScheduler::Install(sched);
	CTe_rtpwrapperCoreServer* server = NULL;
	// Create the CTestServer derived server
	TRAPD(err,server = CTe_rtpwrapperCoreServer::NewL());
	if(!err)
		{
		CleanupStack::PushL(server);
		RSemaphore sem;
		// The client API will already have created the semaphore
		User::LeaveIfError(sem.OpenGlobal(KServerName));
		CleanupStack::Pop(server);
		// Sync with the client then enter the active scheduler
		sem.Signal();
		sem.Close();
		sched->Start();
		}
	CleanupStack::Pop(sched);
	delete server;
	delete sched;
	}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
static TInt StartLockServer()
    {
    TInt result;

    TFindServer findTimeServer(KCrashServerName);
    TFullName name;

	result = findTimeServer.Next(name);
	if (result == KErrNone)
        {
		// Server already running
		return KErrNone;
	    }

	RSemaphore semaphore;		
	result = semaphore.CreateGlobal(KCrashServerSemaphoreName, 0);
    if (result != KErrNone)
        {
        return  result;
        }

    result = CreateLockServerProcess();
    if (result != KErrNone)
        {
        return  result;
        }

	semaphore.Wait();
	semaphore.Close();       

    return  KErrNone;
    }
예제 #9
0
// ---------------------------------------------------------------------------
// StartServerL()  
//  Starts Fota Downlaod Interrupt Monitory server
// ---------------------------------------------------------------------------
TInt StartServerL()
    {
    FLOG(_L("StartServerLt Started"));
    TInt res = KErrNone;
    
    RProcess server;
    RSemaphore sem;
    res = sem.CreateGlobal(KFotaServerScem, EOwnerProcess);

    res=server.Create(KFotaServerName,KNullDesC);
    FLOG(_L("StartServerL-- create server error as %d"),res);
    if (res!=KErrNone)
        {       
        return res;
        }

    server.Resume();    // logon OK - start the server
    
    sem.Wait();
    sem.Close();
    server.Close();
    
    FLOG(_L("StartServerL-- server.ExitType() returns %d"),res);

    return res;
    }
void CSuplProxyPrivacySession::NewPrivacyRequest(const RMessage2& aMessage)
	{
	LBSLOG(ELogP1, "CSuplProxyPrivacySession::NewPrivacyRequest() Begin\n");

	TLbsNetSessionId sessionId;
	iPrivacyProtocol.GetNextSessionId(sessionId);

	TPckg<TUint32> pkgReqId(sessionId.SessionNum());
	TInt error = aMessage.Write(0,pkgReqId);
	if(error != KErrNone)
		{
		aMessage.Complete(error);
		return;
		}
	
	RSemaphore semaphore;
	error = semaphore.Open(aMessage, 3, EOwnerThread);
	if(error != KErrNone)
		{
		aMessage.Complete(error);
		return;
		}
	semaphore.Signal();
	semaphore.Close();

	PrivacyRequest(aMessage, sessionId.SessionNum());

	LBSLOG(ELogP1, "CSuplProxyPrivacySession::NewPrivacyRequest() End\n");
	}
void CAlmSettingsServer::SignalL(void)
{
  RSemaphore semaphore;
  User::LeaveIfError(semaphore.OpenGlobal(KSettingsServerSemaphoreName));
  semaphore.Signal();
  semaphore.Close();
}
예제 #12
0
void CMySession::ServiceL(const RMessage2& aMessage)
//
// Handle messages for this server.
//
	{
	RSemaphore svrSem;

	//CMySession &c=(CMySession &)aClient;// passed as CSession2 since fn overloads pure virtual fn
	TInt r=KErrNone;
	switch (aMessage.Function())
		{
	case ETest:
		break;
	case ENeverComplete:
		r = svrSem.OpenGlobal(KSvrSemName);
		if (r != KErrNone)
			break;
		svrSem.Signal(); // all ready for the server to be killed
		svrSem.Close();
		return;
	default:
		r=KErrNotSupported;
		}
	aMessage.Complete(r);
	}
예제 #13
0
TInt CClkNitzModel::IsNitzSrvRunning(void)
{
  TInt err=KErrNone;
  _LIT(KServer,"ClkNitzMdlServer");
  _LIT(KSem,"ClkNitzMdlStartSemaphore");
  TFindServer find(KServer);
  TFullName name;
  if(find.Next(name)!=KErrNone)
  {
    RSemaphore sem;
    TInt i=0;
    do
    {
      err=sem.OpenGlobal(KSem);
      if(err==KErrNone)
      {
        sem.Close();
        break;
      }
      User::After(1000000);
      i++;
    } while(i<6);
  }
  return err;
}
예제 #14
0
// -----------------------------------------------------------------------------
// RDosServer::StartServer
// Creates the server thread/process
// -----------------------------------------------------------------------------
EXPORT_C TInt RDosServer::StartServer() const
{
    API_TRACE_( "[DOSSERVER] RDosServer::StartServer()" );

    TInt ret(KErrNone);
	TRequestStatus status;
    // IPCv2: TSignal no longer used, but still passed to threadfunction as 
	// otherwise API change would be required.
	CDosServer::TSignal signal( status );

	// Create startup semaphore
	RSemaphore startupSemaphore;
	ret = startupSemaphore.CreateGlobal( KServerStartupSemaphoreName, 0 );

	if ( ret == KErrAlreadyExists )
		{
		// The server is starting up, but has not yet started 
		startupSemaphore.OpenGlobal( KServerStartupSemaphoreName );
		startupSemaphore.Wait(); // wait until the server has started up.
		startupSemaphore.Close();
		return ret;
		}

	// launch server thread (emulator) or process (Target platform)

	RProcess server;

	ret = server.Create( KDosServerExe, signal.Get(),
                       TUidType( KNullUid, KNullUid, KDosServerUid ),
                       EOwnerThread );

	if ( ret )
	{
		startupSemaphore.Close();
		return ret;
	}

	server.SetPriority(EPriorityHigh);

	server.Resume();
	server.Close();

	startupSemaphore.Wait();
	startupSemaphore.Close();

	return KErrNone;
}
예제 #15
0
LOCAL_C void DoTestsL()
    {
    
    // Initialisation
    MainTest.Start(_L("@SYMTESTCaseID:PIM-T-CONCURRENT-0001 T_Concurrent"));

    
    // Create active scheduler (to run active objects)
    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    // Create main thread object, child thread and synchnising semaphore.
    sem.CreateLocal(0);
    CMainThread * ptr = CMainThread::NewL();
    CleanupStack::PushL(ptr);
    ptr->LaunchChildThreadL();
	
	// Run all the tests
	while (currentStep <= ETestsEnd)
		{
		switch(currentStep)
			{
			case ETestCreate:
				// create the db in shared mode and add a contact. 
			    ptr->TestCreateDatabaseL();
			    ptr->TestAddContactL();
				break;
			case ETestOpen:
			 	// create the db in shared mode 
			    ptr->TestOpenDatabaseL();
			    ptr->TestAddContactL();
				break;
			case ETestReplace:
				// create the db in shared mode 
			    ptr->TestReplaceDatabaseL();
				ptr->TestAddContactL();
				break;
			case ETestsEnd:
				break;
			default:
				break;
			} // end of switch
			
			// Run the child thread and let it access the shared session.
		    ptr->ResumeChildThreadL();
		    sem.Wait();
		    ptr->CloseDatabaseSessionL();
		    currentStep++ ;
		} // end of while

    // Cleanup and close.
    sem.Close();
    CleanupStack::PopAndDestroy(ptr);
    CleanupStack::PopAndDestroy(scheduler);
    }
예제 #16
0
void CTestAppUi::ConstructL()
	{
	// Complete the UI framework's construction of the App UI.
	BaseConstructL(CEikAppUi::ENoAppResourceFile);

	iPropertyObs = new(ELeave) CPropertyObserver;
	iPropertyObs->StartL();

    //Signal that application is started
    RSemaphore sem;
    TInt err = sem.OpenGlobal(KStartShmaTestAppGood);
    if(err == KErrNone)
        {
        sem.Signal();
        sem.Close();
        }

	RFs fs;
	err = fs.Connect();
	User::LeaveIfError(err);
	CleanupClosePushL(fs);
	
	RFile file;
	err = file.Open(fs, KPanicFile, EFileRead);
	if (err == KErrNotFound)
		{
		CleanupStack::PopAndDestroy(&fs);
		// We are not using the file, so just return
		return;
		}
	else
		{
		User::LeaveIfError(err);
		CleanupClosePushL(file);
		
		TBuf8<30> buf;
		err = file.Read(buf);
		User::LeaveIfError(err);

		CleanupStack::PopAndDestroy(&file);
		err = fs.Delete(KPanicFile);

		RBuf8 writableArgs;
		writableArgs.CreateL(buf, 30);
		CleanupClosePushL(writableArgs);
		TPtr16 args16 = writableArgs.Expand();
	
		_LIT(KTestGoodProcPanic, "Panic");
	 	if (args16 == KPanicCommandLineOption1)
	 		User::Panic(KTestGoodProcPanic, KProcPanic);
	 	else if (args16 == KPanicCommandLineOption2)
			User::Panic(KTestGoodProcPanic, KErrNone);
	 	
	 	CleanupStack::PopAndDestroy(2, &fs);
		}
	}
void DoTestsL()
	{
    MainThreadCrS.CreateLocal(0);
    
    TheTest.Start(_L(" @SYMTestCaseID:PDS-EFM-CT-4058 Restore Query and Modification Response"));
    TestRestoreResponseL();
    
    MainThreadCrS.Close();

	}
static void SignalTestExe()
	{
	_LIT(KSchSemaphoreName, "SCHMinimalTaskHandler");
	RSemaphore sem;
	TInt ret = sem.OpenGlobal(KSchSemaphoreName);
	if (ret == KErrNone)
		{
		sem.Signal();
		sem.Close();
		}
	}
예제 #19
0
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
{
	if ( sem ) 
	{
    RSemaphore sema;
    sema.SetHandle(sem->handle);
	sema.Signal(sema.Count());
    sema.Close();
    delete sem;
	sem = NULL;
	}
}
예제 #20
0
/**
 *
 * CTestFrameworkMain - start testing.
 * Calls main test loop.
 *
 * @param "const TDesC& aCmdLine"
 *			The command line
 * 
 * @xxxx
 *
 */
void CTestFrameworkMain::StartTestingL(const TDesC& aCmdLine)
	{
	RunTestScriptL(aCmdLine);

	RSemaphore sem;
	TInt err = sem.OpenGlobal(KRecogSemaphoreName);
	if (err==KErrNone)
		{
		// Tell the recognizer thread that we're finished
		sem.Signal();
		sem.Close();
		}
	}
// ---------------------------------------------------------------------------
// Start server if it isn't running already
// ---------------------------------------------------------------------------
//
TInt RCatalogsPCConnectivityClient::StartServer()
    {
    // Check if the server is already running
    TFindServer findServer( KCatalogsPCConnectivityServerName );
    TFullName name;

    TInt result = findServer.Next( name );
    if ( result == KErrNone )
        {
        // Server is running
        return KErrNone;
        }

    // Create a semaphore so we can wait while the server starts
    RSemaphore semaphore;
    result = semaphore.CreateGlobal( 
    	KCatalogsPCConnectivityServerSemaphoreName, 0 );
    if ( result != KErrNone )
        {
        return result;
        }

    // Create new Engine service process 
    result = CreateServerProcess();
    if ( result != KErrNone )
        {
        semaphore.Close();
        return result;
        }

    // Wait while the server starts
    semaphore.Wait();

    // Semaphore has been signaled, close and return
    semaphore.Close();

    return KErrNone;
    }
예제 #22
0
TInt StartThread() {
	TInt result;

	TFindServer findSoundServer(KSoundStreamServerName);
	TFullName name;

	result = findSoundServer.Next(name);
	if (result == KErrNone) {
		// Server already running
		return KErrNone;
	}

	RSemaphore semaphore;
	result = semaphore.CreateGlobal(KSoundStreamServerSemaphoreName, 0);

	if (result != KErrNone) {
		return result;
	}

	RThread thread;

	result=thread.Create(
		KSoundStreamServerName,   // create new server thread
		CSoundStreamServer::ThreadFunction, // thread's main function
		KDefaultStackSize,
		NULL, // share heap with current thread
		&semaphore // passed as TAny* argument to thread function
		);

	if (result != KErrNone) {
		return result;
	}

    thread.SetPriority(EPriorityRealTime); // set thread priority to realtime

	thread.Resume(); // start it going
	thread.Close(); // we're no longer interested in the other thread

	// notify the kernel that a server has started.
	#if defined (__WINS__)
	UserSvr::ServerStarted();
	#endif
	
	// wait for signal from other thread
    semaphore.Wait();
	semaphore.Close();

	return KErrNone;
}
예제 #23
0
// -----------------------------------------------------------------------------
// Function StartClockServer().
// This function starts the actual server under TRAP harness and starts
// waiting for connections. This function returns only if there has been
// errors during server startup or the server is stopped for some reason.
// 
// Returns: TInt: Symbian OS error code.
// -----------------------------------------------------------------------------
LOCAL_C TInt StartClockServer( RSemaphore& aClientSem ) 

    {
    TInt error = KErrNone;
    CDRMClockServer* server = NULL;

    TUint8 count = 0;

    do 
    {
       DRMLOG2( _L( "unipertar.exe: StartClockServer: %d" ), error );
       
       ++count;
       
       TRAP( error, ( server = CDRMClockServer::NewL() ) );
       
       if ( error ) 
       {
          User::After( TTimeIntervalMicroSeconds32(KWaitingTime) );
       }
       
    } while( error && ( count <= KMaxStartTries ) );
    
    if( error ) 
    {
        // Failed
        return error;
        }
       
    // Release the semaphore...
    aClientSem.Signal();
    
    // and close it. Otherwise there will be an unused handle to the semaphore
    // until the phone is switched off.
    aClientSem.Close();
    
    DRMLOG( _L( "unipertar.exe: StartClockServer: starting..." ) );

    // Start waiting for connections
    CActiveScheduler::Start();
    
    // Dying.
    
    DRMLOG( _L( "unipertar.exe: StartClockServer: dying" ) );

    delete server;
    
    return KErrNone;
    }
예제 #24
0
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
{
	if ( sem ) 
	{
    RSemaphore sema;
    sema.SetHandle(sem->handle);
#if !defined (UIQ3) && !defined(S60V3)
	sema.Signal(sema.Count());
#else
	sema.Signal(sem->count);
#endif
    sema.Close();
    delete sem;
	sem = NULL;
	}
}
예제 #25
0
// -----------------------------------------------------------------------------
// CSearchServer::ThreadFunctionL()
// Second stage startup for the server thread.
// -----------------------------------------------------------------------------
//
void CSearchServer::ThreadFunctionL()
	{
	// Construct active scheduler
    User::RenameThread(KSearchServerName); 
	CActiveScheduler* activeScheduler = new ( ELeave ) CActiveScheduler;
	CleanupStack::PushL(activeScheduler);

	// Install active scheduler
	CActiveScheduler::Install(activeScheduler);

	// Construct server
	CSearchServer* server = CSearchServer::NewLC();
	
    // Rename the thread.
           
    RProcess::Rendezvous(KErrNone);           

	// Signal client thread if started by such
	RSemaphore semaphore;
	TInt err = semaphore.OpenGlobal(KSearchServerSemaphoreName);
	if (KErrNone == err)
		{
		// Started by client
		semaphore.Signal();
		semaphore.Close();
		}
	else
		{
		if (KErrNotFound == err)
			{
			// Started by S60 starter
			}
		else
			{
			// Unknown error, leave
			User::Leave(err);
			}
		}

	// Start handling requests
	CActiveScheduler::Start();
	
	// Cleanup
	CleanupStack::PopAndDestroy( server );
	CleanupStack::PopAndDestroy( activeScheduler );
	}
예제 #26
0
static void RunL()
	{
	User::LeaveIfError(RThread::RenameMe(KTestProcGood));

	CActiveScheduler* s=new(ELeave) CActiveScheduler;
	CleanupStack::PushL(s);
	CActiveScheduler::Install(s);
	
	if(CmdLineOptionL(KLaunchServerCommandLineOption))
		{
		CTestServerGood::NewLC();
		}
		
	if(!CmdLineOptionL(KTestProcGoodNoRendevouz))
		{
		RProcess::Rendezvous(KErrNone);
		}

	if(CmdLineOptionL(KFailAfterRendevouzCommandLineOption))
		{
		User::Leave(KErrAbort);
		}
		
	_LIT(KTestGoodProcPanic, "Panic");
	if(CmdLineOptionL(KPanicCommandLineOption1))
		{
		User::Panic(KTestGoodProcPanic, KProcPanic);
		}

	if(CmdLineOptionL(KPanicCommandLineOption2))
		{
		User::Panic(KTestGoodProcPanic, KErrNone);
		}
	
	RSemaphore sem;
	TInt err = sem.OpenGlobal(KStartShmaTestProcGood);
	if(err == KErrNone)
		{
		sem.Signal();
		sem.Close();
		}
	
	CActiveScheduler::Start();

	CleanupStack::PopAndDestroy(2);
	}
예제 #27
0
GLDEF_C TInt EtelServerThread(TAny* /*anArg*/)
//
// The ETel Server Thread.
//
	{
	__UHEAP_MARK;
	LOGTEXT(_L8("----------New Log----------\015\012"));
	LOGTEXT(_L8("Entered ETel Server thread"));
	LOGTEXTREL(_L8("Entered ETel Server thread"));

	CTrapCleanup* pT;
	if ((pT=CTrapCleanup::New())==NULL)
		Fault(EEtelFaultCreateTrapCleanup);

	//
	// Start the scheduler and then the server
	//
	CTelScheduler* pScheduler = CTelScheduler::New();
	CTelServer* pServer=CTelServer::New();

	User::SetCritical(User::ENotCritical);
	RSemaphore s;
	TInt semRet=s.OpenGlobal(KETelSemaphoreName);

	if (semRet==KErrNone)
		{
		s.Signal();
		s.Close();
		}
	RLibrary lib;
	lib.Load(KEtelDLLName); // to ensure the access count on the library is always >0
										// while the ETel thread is running
	CTelScheduler::Start();
	LOGTEXT(_L8("ETel:\tScheduler has been stopped\n"));

	delete pT;
	delete pServer;
	delete pScheduler;

	LOGTEXT(_L8("ETel:\tAbout to exit ETel thread function\n"));
	LOGTEXTREL(_L8("ETel:\tAbout to exit ETel thread function\n"));
	__UHEAP_MARKEND;

	return(KErrNone);
	}
예제 #28
0
// -----------------------------------------------------------------------------
// SipCRServerMain::ThreadFunctionL
// -----------------------------------------------------------------------------
//
void SipCRServerMain::ThreadFunctionL (RSemaphore& aSemaphore)
	{
	// Give a name to this thread
    User::LeaveIfError(User::RenameThread(KSipClientResolverServerName));

    // Construct server
    CSIPCRServer::NewLC();

	// Server created ok
	aSemaphore.Signal();
	aSemaphore.Close();

	// Start handling requests
	CActiveScheduler::Start();

    // This will be executed after the active scheduler has been stopped:
    CleanupStack::PopAndDestroy(1); // server
	}
예제 #29
0
TInt StartupClock( TAny* ) 
    {
    DRMLOG( _L( "unipertar.exe: StartupClock" ) );
    TInt error = KErrNone;
    CTrapCleanup* trap = CTrapCleanup::New();
    
    // Check that memory allocation was successful.
    __ASSERT_ALWAYS( trap, User::Invariant() );
    
    DRMLOG( _L( "unipertar.exe: StartupClock: active scheduler" ) );

    CActiveScheduler* scheduler = new CActiveScheduler();
    
    __ASSERT_ALWAYS( scheduler, User::Invariant() );
    
    CActiveScheduler::Install( scheduler );
    
    // Reusing semaphore
    RSemaphore clientSem;
    __ASSERT_ALWAYS( !( clientSem.OpenGlobal( KDRMEngCommonSemaphore ) ), 
        User::Invariant() );
    
    error = StartClockServer( clientSem );
    
    if ( error ) {
        // Server creation failed. Release the semaphore.
        // In case of successful startup, CDRMClockServer
        // releases the semaphore.
        clientSem.Signal();
        clientSem.Close();
        }
    
    delete scheduler; 
    scheduler = NULL;
    
    delete trap;
    trap = NULL;
    
    DRMLOG2( _L( "unipertar.exe: StartupClock exits with %d" ), error );
    
    return error;
    }
예제 #30
0
// The server thread.
void CSoundStreamServer::ThreadFunctionL() {
	
	// start scheduler and server
	CActiveScheduler *pA=new CActiveScheduler;
	CleanupStack::PushL(pA);
	CActiveScheduler::Install(pA);

	CSoundStreamServer::NewLC();
	
	RSemaphore semaphore;
	User::LeaveIfError(semaphore.OpenGlobal(KSoundStreamServerSemaphoreName));

	// Semaphore opened ok
	semaphore.Signal();
	semaphore.Close();

	// start active scheduler
	CActiveScheduler::Start();

	CleanupStack::PopAndDestroy(2, pA);
}