summaryrefslogtreecommitdiff
path: root/src/win32/winService.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-22 06:16:10 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-22 06:16:10 +0000
commit5c0eb60b509edf766e649d081d30ab8dea83a8f4 (patch)
tree7e7ffa3e6aaa42f65ea13ac3297890e64b66944b /src/win32/winService.cpp
parentfixed build on Windows (after logging chances) (diff)
added signal controller (console control handler) to windows
Diffstat (limited to 'src/win32/winService.cpp')
-rw-r--r--src/win32/winService.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/win32/winService.cpp b/src/win32/winService.cpp
index 78558de..fb20f8f 100644
--- a/src/win32/winService.cpp
+++ b/src/win32/winService.cpp
@@ -145,7 +145,8 @@ void WinService::waitForStop()
{
if(!started_)
throw std::runtime_error("Service not started correctly");
-
+
+ reportStatus(SERVICE_RUNNING, NO_ERROR);
WaitForSingleObject(stop_event_, INFINITE);
reportStatus(SERVICE_STOP_PENDING, NO_ERROR);
}
@@ -175,16 +176,15 @@ VOID WINAPI WinService::main(DWORD dwArgc, LPTSTR *lpszArgv)
gWinService.status_.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
gWinService.status_.dwServiceSpecificExitCode = 0;
gWinService.reportStatus(SERVICE_START_PENDING, NO_ERROR);
-
+ gWinService.started_ = true;
+
gWinService.stop_event_ = CreateEvent(NULL, true, false, NULL);
if(!gWinService.stop_event_) {
- cLog.msg(Log::PRIO_ERR) << "Error on CreateEvent: " << LogErrno(GetLastError());
+ cLog.msg(Log::PRIO_ERR) << "WinService Error on CreateEvent: " << LogErrno(GetLastError());
gWinService.reportStatus(SERVICE_STOPPED, -1);
return;
}
- gWinService.started_ = true;
- gWinService.reportStatus(SERVICE_RUNNING, NO_ERROR);
-
+
real_main(dwArgc, lpszArgv);
}