instance.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // instance.h :
  2. //
  3. #if !defined(AGD_INSTANCE_H__54A0DC49_C449_49EB_B41B_ACF625001760__INCLUDED_)
  4. #define AGD_INSTANCE_H__54A0DC49_C449_49EB_B41B_ACF625001760__INCLUDED_
  5. #include <unistd.h>
  6. #include <sys/types.h>
  7. #include <linux/limits.h>
  8. #ifdef __cplusplus
  9. /////////////////////////////////////////////////////////////////////////////
  10. // instance.h - Declarations:
  11. #define _USE_BINARY_LOCK 1
  12. /////////////////////////////////////////////////////////////////////////////
  13. class CProcessInstance
  14. {
  15. public:
  16. CProcessInstance(void);
  17. ~CProcessInstance(void);
  18. bool LockInstance(const char *pszUuid);
  19. void UnlockInstance(void);
  20. private:
  21. #if _USE_BINARY_LOCK
  22. char m_szBinaryPath[PATH_MAX];
  23. #else // _USE_BINARY_LOCK
  24. char m_szPidFileDir[PATH_MAX];
  25. char m_szPidFilePath[PATH_MAX];
  26. #endif // _USE_BINARY_LOCK
  27. pid_t m_pid;
  28. private:
  29. static int m_fdPid;
  30. };
  31. /////////////////////////////////////////////////////////////////////////////
  32. #endif // __cplusplus
  33. #endif // !defined(AGD_INSTANCE_H__54A0DC49_C449_49EB_B41B_ACF625001760__INCLUDED_)