2009-06-23 23:43
从CS架构的示例代码中看到两种方式.
1. 信号量。来自S60Ex/ClientServerSync //=================client process======== RSemaphore semaphore; result = semaphore.CreateGlobal( KTimeServerSemaphoreName, 0 ); if ( result != KErrNone ) { return result; } result = CreateServerProcess(); if ( result != KErrNone ) { return result; } semaphore.Wait(); semaphore.Close(); //===========server process======== RSemaphore semaphore; User::LeaveIfError( semaphore.OpenGlobal( KTimeServerSemaphoreName ) ); // Semaphore opened ok semaphore.Signal(); semaphore.Close(); 2. RProcess::Rendezvous 这个更简单 //============client process================ TRequestStatus stat; server.Rendezvous(stat); if(stat != KRequestPending) { server.Kill(0); // abort startup } else { server.Resume(); // logon OK - start the server } User::WaitForRequest(stat); // wait for start or death //===========server process======== RProcess::Rendezvous(KErrNone); |