Event.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include "il2cpp-config.h"
  2. #include "os/Event.h"
  3. #if IL2CPP_SUPPORT_THREADS
  4. #if IL2CPP_THREADS_WIN32
  5. #include "os/Win32/EventImpl.h"
  6. #elif IL2CPP_THREADS_PTHREAD
  7. #include "os/Posix/EventImpl.h"
  8. #else
  9. #include "os/EventImpl.h"
  10. #endif
  11. namespace il2cpp
  12. {
  13. namespace os
  14. {
  15. Event::Event(bool manualReset, bool signaled)
  16. : m_Event(new EventImpl(manualReset, signaled))
  17. {
  18. }
  19. Event::~Event()
  20. {
  21. delete m_Event;
  22. }
  23. ErrorCode Event::Set()
  24. {
  25. return m_Event->Set();
  26. }
  27. ErrorCode Event::Reset()
  28. {
  29. return m_Event->Reset();
  30. }
  31. WaitStatus Event::Wait(bool interruptible)
  32. {
  33. return m_Event->Wait(interruptible);
  34. }
  35. WaitStatus Event::Wait(uint32_t ms, bool interruptible)
  36. {
  37. return m_Event->Wait(ms, interruptible);
  38. }
  39. void* Event::GetOSHandle()
  40. {
  41. return m_Event->GetOSHandle();
  42. }
  43. }
  44. }
  45. #else
  46. namespace il2cpp
  47. {
  48. namespace os
  49. {
  50. Event::Event(bool manualReset, bool signaled)
  51. {
  52. }
  53. Event::~Event()
  54. {
  55. }
  56. ErrorCode Event::Set()
  57. {
  58. return kErrorCodeSuccess;
  59. }
  60. ErrorCode Event::Reset()
  61. {
  62. return kErrorCodeSuccess;
  63. }
  64. WaitStatus Event::Wait(bool interruptible)
  65. {
  66. return kWaitStatusSuccess;
  67. }
  68. WaitStatus Event::Wait(uint32_t ms, bool interruptible)
  69. {
  70. return kWaitStatusSuccess;
  71. }
  72. void* Event::GetOSHandle()
  73. {
  74. return NULL;
  75. }
  76. }
  77. }
  78. #endif