summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ccapi/common/win/win-utils.h3
-rw-r--r--src/ccapi/server/win/ccs_os_server.cpp9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ccapi/common/win/win-utils.h b/src/ccapi/common/win/win-utils.h
index 6469a61e8b..41cab24dcd 100644
--- a/src/ccapi/common/win/win-utils.h
+++ b/src/ccapi/common/win/win-utils.h
@@ -42,7 +42,8 @@ static enum ccapiMsgType {
CCMSG_REQUEST_REPLY,
CCMSG_DISCONNECT,
CCMSG_LISTEN,
- CCMSG_PING
+ CCMSG_PING,
+ CCMSG_QUIT
};
char* clientEndpoint(const char* UUID);
diff --git a/src/ccapi/server/win/ccs_os_server.cpp b/src/ccapi/server/win/ccs_os_server.cpp
index 811090ba51..9a45e72c0c 100644
--- a/src/ccapi/server/win/ccs_os_server.cpp
+++ b/src/ccapi/server/win/ccs_os_server.cpp
@@ -199,6 +199,7 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) {
ParseOpts::Opts opts = { 0 };
ParseOpts PO;
+ BOOL bQuit = FALSE;
opts.cMinCalls = 1;
opts.cMaxCalls = 20;
@@ -230,7 +231,7 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) {
threadStatus = _beginthread(receiveLoop, 0, (void*)&rpcargs);
/* We handle the queue entries here. Work loop: */
- while (TRUE) {
+ while (!bQuit) {
worklist_wait();
while (!worklist_isEmpty()) {
k5_ipc_stream buf = NULL;
@@ -243,6 +244,10 @@ cc_int32 ccs_os_server_listen_loop (int argc, const char *argv[]) {
ccs_pipe_t pipe2 = NULL;
if (worklist_remove(&rpcmsg, &pipe, &buf, &serverStartTime)) {
+ if (rpcmsg == CCMSG_QUIT) {
+ bQuit = TRUE;
+ break;
+ }
uuid = ccs_win_pipe_getUuid(pipe);
#if 0
cci_debug_printf("%s: processing WorkItem msg:%ld pipeUUID:<%s> pipeHandle:0x%X SST:%ld",
@@ -462,6 +467,8 @@ void receiveLoop(void* rpcargs) {
free_alloc_p(&endpoint);
}
+ // tell main thread to shutdown since it won't receive any more messages
+ worklist_add(CCMSG_QUIT, NULL, NULL, 0);
_endthread();
} // End receiveLoop