mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
25 lines
535 B
C++
25 lines
535 B
C++
#include "storm/thread/CSRWLock.hpp"
|
|
|
|
void CSRWLock::Enter(int32_t forwriting) {
|
|
#ifdef WHOA_PLATFORM_WIN
|
|
// TODO
|
|
#endif
|
|
|
|
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
|
|
if (forwriting) {
|
|
pthread_rwlock_wrlock(&this->m_lock);
|
|
} else {
|
|
pthread_rwlock_rdlock(&this->m_lock);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void CSRWLock::Leave(int32_t fromwriting) {
|
|
#ifdef WHOA_PLATFORM_WIN
|
|
// TODO
|
|
#endif
|
|
|
|
#if defined(WHOA_PLATFORM_MAC) || defined(WHOA_PLATFORM_LINUX)
|
|
pthread_rwlock_unlock(&this->m_lock);
|
|
#endif
|
|
}
|