ReaderWriterLock.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #include "il2cpp-config.h"
  2. #include "os/ReaderWriterLock.h"
  3. #if IL2CPP_SUPPORT_THREADS
  4. #if IL2CPP_THREADS_WIN32
  5. #include "os/Win32/ReaderWriterLockImpl.h"
  6. #elif IL2CPP_THREADS_PTHREAD
  7. #include "os/Posix/ReaderWriterLockImpl.h"
  8. #else
  9. #include "os/ReaderWriterLockImpl.h"
  10. #endif
  11. namespace il2cpp
  12. {
  13. namespace os
  14. {
  15. ReaderWriterLock::ReaderWriterLock()
  16. : m_Impl(new ReaderWriterLockImpl())
  17. {
  18. }
  19. ReaderWriterLock::~ReaderWriterLock()
  20. {
  21. delete m_Impl;
  22. }
  23. void ReaderWriterLock::LockExclusive()
  24. {
  25. m_Impl->LockExclusive();
  26. }
  27. void ReaderWriterLock::LockShared()
  28. {
  29. m_Impl->LockShared();
  30. }
  31. void ReaderWriterLock::ReleaseExclusive()
  32. {
  33. m_Impl->ReleaseExclusive();
  34. }
  35. void ReaderWriterLock::ReleaseShared()
  36. {
  37. m_Impl->ReleaseShared();
  38. }
  39. ReaderWriterLockImpl* ReaderWriterLock::GetImpl()
  40. {
  41. return m_Impl;
  42. }
  43. }
  44. }
  45. #else
  46. #include <stddef.h>
  47. namespace il2cpp
  48. {
  49. namespace os
  50. {
  51. ReaderWriterLock::ReaderWriterLock()
  52. {
  53. }
  54. ReaderWriterLock::~ReaderWriterLock()
  55. {
  56. }
  57. void ReaderWriterLock::LockExclusive()
  58. {
  59. }
  60. void ReaderWriterLock::LockShared()
  61. {
  62. }
  63. void ReaderWriterLock::ReleaseExclusive()
  64. {
  65. }
  66. void ReaderWriterLock::ReleaseShared()
  67. {
  68. }
  69. ReaderWriterLockImpl* ReaderWriterLock::GetImpl()
  70. {
  71. IL2CPP_ASSERT(0 && "Threads are not enabled for this platform.");
  72. return NULL;
  73. }
  74. }
  75. }
  76. #endif