Team Fortress 2 Source Code as on 22/4/2020
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

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SERVICE_HELPERS_H
  8. #define SERVICE_HELPERS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // Call this if you want to use the ExitEarly() and ShouldExit() helpers.
  13. void ServiceHelpers_Init();
  14. // Start this app in the service control manager.
  15. //
  16. // The service will run in a thread. If the service starts successfully, then
  17. // it will call pFn and pass in pParam. Inside there, you should loop until
  18. // ShouldServiceExit() returns true.
  19. bool ServiceHelpers_StartService( const char *pServiceName, void (*pFn)( void *pParam ), void *pParam );
  20. // Call this to exit the service early. This will make ShouldServiceExit() return true,
  21. // and your main thread function should pick it up and exit.
  22. //
  23. // NOTE: this can be used even if the service isn't running as long as you call ServiceHelpers_Init().
  24. void ServiceHelpers_ExitEarly();
  25. // Your thread loop should call this each time around. If this function returns true,
  26. // then your thread function should return, causing the service to exit.
  27. //
  28. // NOTE: this can be used even if the service isn't running as long as you call ServiceHelpers_Init().
  29. bool ServiceHelpers_ShouldExit();
  30. // This function wants a better home.
  31. char* GetLastErrorString();
  32. #endif // SERVICE_HELPERS_H