(file) Return to ServerProcessWindows.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Service

Diff for /pegasus/src/Service/ServerProcessWindows.cpp between version 1.7 and 1.8

version 1.7, 2007/04/03 18:51:01 version 1.8, 2007/05/08 18:30:52
Line 38 
Line 38 
 #include <Pegasus/Common/MessageLoader.h> #include <Pegasus/Common/MessageLoader.h>
 #include <Pegasus/Common/Thread.h> #include <Pegasus/Common/Thread.h>
 #include <Pegasus/Server/CIMServer.h> #include <Pegasus/Server/CIMServer.h>
   #include <Service/ServerRunStatus.h>
  
 #include "Service.cpp" #include "Service.cpp"
  
 PEGASUS_USING_PEGASUS; PEGASUS_USING_PEGASUS;
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 static const char* _ALREADY_RUNNING_NAME = 0;  
   
 //------------------------------------------------------------------------- //-------------------------------------------------------------------------
 // GLOBALS // GLOBALS
 //------------------------------------------------------------------------- //-------------------------------------------------------------------------
Line 77 
Line 76 
 //------------------------------------------------------------------------- //-------------------------------------------------------------------------
 int ServerProcess::cimserver_fork(void) { return(0); } int ServerProcess::cimserver_fork(void) { return(0); }
 void ServerProcess::notify_parent(int id) { return; } void ServerProcess::notify_parent(int id) { return; }
 long ServerProcess::get_server_pid(void) { return 0; }  
 void ServerProcess::set_parent_pid(int pid) {}  
 int ServerProcess::get_proc(int pid) { return 0; }  
 int ServerProcess::cimserver_kill(int id) { return(0); }  
 void cimserver_exitRC(int rc) {} void cimserver_exitRC(int rc) {}
 int ServerProcess::cimserver_initialize(void) { return 0; } int ServerProcess::cimserver_initialize(void) { return 0; }
 int ServerProcess::cimserver_wait(void) { return 0; } int ServerProcess::cimserver_wait(void) { return 0; }
Line 107 
Line 102 
         _server_proc->cimserver_stop();         _server_proc->cimserver_stop();
  
     pegasus_service = Service(getProcessName());     pegasus_service = Service(getProcessName());
     _ALREADY_RUNNING_NAME = getProcessName();  
 } }
  
 void signal_shutdown() void signal_shutdown()
Line 190 
Line 184 
     return 0;     return 0;
 } }
  
 //-------------------------------------------------------------------------  
 // IS RUNNING?  
 //-------------------------------------------------------------------------  
   
 class AlreadyRunning  
 {  
 public:  
     AlreadyRunning(): alreadyRunning( true ), event( NULL )  
     {  
     }  
     ~AlreadyRunning()  
     {  
         if( event != NULL )  
             CloseHandle( event );  
     }  
   
     void Init()  
     {  
         if( event == NULL )  
         {  
             event = CreateEvent( NULL, TRUE, TRUE, _ALREADY_RUNNING_NAME );  
             if( event != NULL && GetLastError() != ERROR_ALREADY_EXISTS )  
                 alreadyRunning = false;  
         }  
     }  
   
     bool IsAlreadyRunning()  
     {  
         return alreadyRunning;  
     }  
   
     bool alreadyRunning;  
     HANDLE event;  
 };  
   
 AlreadyRunning _alreadyRunning;  
   
   
 Boolean ServerProcess::isCIMServerRunning(void)  
 {  
     //Service::State state;  
     //pegasus_service.GetState(&state);  
     //return (state == Service::SERVICE_STATE_RUNNING) ? true : false;  
   
     // We do it this way so this will work when run as a  
     // console process and a Windows service.  
     AlreadyRunning ar;  
     ar.Init();  
     return ar.IsAlreadyRunning();  
 }  
  
 //------------------------------------------------------------------------- //-------------------------------------------------------------------------
 // INSTALL // INSTALL
Line 642 
Line 586 
     // Signal ourself as running     // Signal ourself as running
     //     //
  
       // NOTE: This object must persist for the life of the server process
       ServerRunStatus serverRunStatus(getProcessName(), getPIDFileName());
   
     if( !shutdownOption )     if( !shutdownOption )
         _alreadyRunning.Init();      {
           serverRunStatus.setServerRunning(0);
       }
  
     //     //
     // Check if already running     // Check if already running
Line 654 
Line 603 
     // then the service will start up then die silently.     // then the service will start up then die silently.
     //     //
  
     if( !shutdownOption && _alreadyRunning.IsAlreadyRunning() )      if (!shutdownOption && serverRunStatus.isServerRunning())
     {     {
         MessageLoaderParms parms(         MessageLoaderParms parms(
             "src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",             "src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",


Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2