dcop
dcopserver_win.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <qeventloop.h>
00023
00024 DWORD WINAPI DCOPServer::TerminatorThread(void * pParam)
00025 {
00026 DCOPServer * server = (DCOPServer*)pParam;
00027
00028 WaitForSingleObject(server->m_evTerminate,INFINITE);
00029 fprintf( stderr, "DCOPServer : terminate event signaled\n" );
00030 if(!server->shutdown) {
00031
00032 ResetEvent(server->m_evTerminate);
00033 server->slotShutdown();
00034
00035
00036
00037 while(WaitForSingleObject(server->m_evTerminate,100) != WAIT_OBJECT_0)
00038 QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput|QEventLoop::ExcludeSocketNotifiers);
00039 fprintf( stderr, "DCOPServer : terminated event signaled the last time\n" );
00040 }
00041 fprintf( stderr, "DCOPServer : terminate thread teminated\n" );
00042 return 0;
00043 }
00044
00045 BOOL WINAPI DCOPServer::dcopServerConsoleProc(DWORD dwCtrlType)
00046 {
00047 BOOL ret;
00048 switch(dwCtrlType)
00049 {
00050 case CTRL_BREAK_EVENT:
00051 case CTRL_CLOSE_EVENT:
00052 case CTRL_LOGOFF_EVENT:
00053 case CTRL_SHUTDOWN_EVENT:
00054 case CTRL_C_EVENT:
00055 system(findDcopserverShutdown()+" --nokill");
00056 ret = TRUE;
00057 break;
00058 default:
00059 ret = FALSE;
00060 }
00061 return ret;
00062 }
00063