FastReaderReaderWriterLock.cpp 1.8 KB

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