Mutex_s.h 838 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #if defined _WIN32
  17. HANDLE ___2494;
  18. #else
  19. pthread_mutex_t ___2494;
  20. #endif
  21. ___2665() {
  22. #if defined _WIN32
  23. ___2494 = CreateMutex(NULL, ___1305, NULL);
  24. #else
  25. pthread_mutex_init(&___2494, NULL);
  26. #endif
  27. } ~___2665() {
  28. #if defined _WIN32
  29. CloseHandle(___2494);
  30. #else
  31. pthread_mutex_destroy(&___2494);
  32. #endif
  33. } void lock() {
  34. #if defined _WIN32
  35. WaitForSingleObject(___2494, INFINITE);
  36. #else
  37. pthread_mutex_lock(&___2494);
  38. #endif
  39. } void unlock() {
  40. #if defined _WIN32
  41. ReleaseMutex(___2494);
  42. #else
  43. pthread_mutex_unlock(&___2494);
  44. #endif
  45. } };