Mutex_s.h 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "ThirdPartyHeadersBegin.h"
  3. #if defined _WIN32
  4. #include <windows.h>
  5. #else
  6. #include <pthread.h>
  7. #if defined __APPLE__
  8. #include <sys/types.h>
  9. #include <sys/sysctl.h>
  10. #endif
  11. #endif
  12. #include "ThirdPartyHeadersEnd.h"
  13. #include "MASTER.h"
  14. #include "GLOBAL.h"
  15. struct ___2665
  16. {
  17. #if defined _WIN32
  18. HANDLE ___2494;
  19. #else
  20. pthread_mutex_t ___2494;
  21. #endif
  22. ___2665()
  23. {
  24. #if defined _WIN32
  25. ___2494 = CreateMutex(NULL, ___1305, NULL);
  26. #else
  27. pthread_mutex_init(&___2494, NULL);
  28. #endif
  29. }
  30. ~___2665()
  31. {
  32. #if defined _WIN32
  33. CloseHandle(___2494);
  34. #else
  35. pthread_mutex_destroy(&___2494);
  36. #endif
  37. }
  38. void lock()
  39. {
  40. #if defined _WIN32
  41. WaitForSingleObject(___2494, INFINITE);
  42. #else
  43. pthread_mutex_lock(&___2494);
  44. #endif
  45. }
  46. void unlock()
  47. {
  48. #if defined _WIN32
  49. ReleaseMutex(___2494);
  50. #else
  51. pthread_mutex_unlock(&___2494);
  52. #endif
  53. }
  54. };