summaryrefslogtreecommitdiff
path: root/utils/vmpi/vmpi_service/service_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/vmpi/vmpi_service/service_helpers.h')
-rw-r--r--utils/vmpi/vmpi_service/service_helpers.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/utils/vmpi/vmpi_service/service_helpers.h b/utils/vmpi/vmpi_service/service_helpers.h
new file mode 100644
index 0000000..dc70f28
--- /dev/null
+++ b/utils/vmpi/vmpi_service/service_helpers.h
@@ -0,0 +1,43 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SERVICE_HELPERS_H
+#define SERVICE_HELPERS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+// Call this if you want to use the ExitEarly() and ShouldExit() helpers.
+void ServiceHelpers_Init();
+
+// Start this app in the service control manager.
+//
+// The service will run in a thread. If the service starts successfully, then
+// it will call pFn and pass in pParam. Inside there, you should loop until
+// ShouldServiceExit() returns true.
+bool ServiceHelpers_StartService( const char *pServiceName, void (*pFn)( void *pParam ), void *pParam );
+
+
+// Call this to exit the service early. This will make ShouldServiceExit() return true,
+// and your main thread function should pick it up and exit.
+//
+// NOTE: this can be used even if the service isn't running as long as you call ServiceHelpers_Init().
+void ServiceHelpers_ExitEarly();
+
+// Your thread loop should call this each time around. If this function returns true,
+// then your thread function should return, causing the service to exit.
+//
+// NOTE: this can be used even if the service isn't running as long as you call ServiceHelpers_Init().
+bool ServiceHelpers_ShouldExit();
+
+
+// This function wants a better home.
+char* GetLastErrorString();
+
+
+#endif // SERVICE_HELPERS_H