Event.cpp 1.4 KB

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