mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(thread): add CSRWLock
This commit is contained in:
parent
3b9f061244
commit
26d78adf7a
3 changed files with 52 additions and 0 deletions
26
storm/thread/CSRWLock.hpp
Normal file
26
storm/thread/CSRWLock.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef STORM_THREAD_CS_RW_LOCK_HPP
|
||||
#define STORM_THREAD_CS_RW_LOCK_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
class CSRWLock {
|
||||
public:
|
||||
// Member variables
|
||||
#ifdef PLATFORM_WIN
|
||||
char m_opaqueData[12];
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
|
||||
pthread_rwlock_t m_lock;
|
||||
#endif
|
||||
|
||||
// Member functions
|
||||
void Enter(int32_t forwriting);
|
||||
void Leave(int32_t fromwriting);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue