Alexandre Julliard : rpcrt4: Implement waiting in RpcMgmtWaitServerListen.

Alexandre Julliard julliard at winehq.org
Wed Nov 10 11:09:36 CST 2010


Module: wine
Branch: master
Commit: 749f22948c9443364637fa11711ff591d48baa0b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=749f22948c9443364637fa11711ff591d48baa0b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov  9 23:11:35 2010 +0100

rpcrt4: Implement waiting in RpcMgmtWaitServerListen.

---

 dlls/rpcrt4/rpc_server.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c
index 0ffc085..8e7fe0e 100644
--- a/dlls/rpcrt4/rpc_server.c
+++ b/dlls/rpcrt4/rpc_server.c
@@ -104,6 +104,8 @@ static BOOL std_listen;
 static LONG manual_listen_count;
 /* total listeners including auto listeners */
 static LONG listen_count;
+/* event set once all listening is finished */
+static HANDLE listen_done_event;
 
 static UUID uuid_nil;
 
@@ -772,6 +774,10 @@ static void RPCRT4_stop_listen(BOOL auto_listen)
       LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
         RPCRT4_sync_with_server_thread(cps);
 
+      EnterCriticalSection(&listen_cs);
+      if (listen_done_event) SetEvent( listen_done_event );
+      listen_done_event = 0;
+      LeaveCriticalSection(&listen_cs);
       return;
     }
     assert(listen_count >= 0);
@@ -1469,6 +1475,8 @@ RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT
  */
 RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
 {
+  HANDLE event;
+
   TRACE("()\n");
 
   EnterCriticalSection(&listen_cs);
@@ -1477,11 +1485,20 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
     LeaveCriticalSection(&listen_cs);
     return RPC_S_NOT_LISTENING;
   }
-  
+  if (listen_done_event) {
+    LeaveCriticalSection(&listen_cs);
+    return RPC_S_ALREADY_LISTENING;
+  }
+  event = CreateEventW( NULL, TRUE, FALSE, NULL );
+  listen_done_event = event;
+
   LeaveCriticalSection(&listen_cs);
 
-  FIXME("not waiting for server calls to finish\n");
+  TRACE( "waiting for server calls to finish\n" );
+  WaitForSingleObject( event, INFINITE );
+  TRACE( "done waiting\n" );
 
+  CloseHandle( event );
   return RPC_S_OK;
 }
 




More information about the wine-cvs mailing list