You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
//========= 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
|