dcopserver_win.cpp

00001 /*
00002    This file is part of the KDE libraries
00003    Copyright (C) 2005 Andreas Roth <aroth@arsoft-online.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 //this file is included by dcopserver.cpp
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         // Wait for main thread to tell us to realy terminate now
00036         // Need some further event processing to get the timer signals
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 
KDE Home | KDE Accessibility Home | Description of Access Keys