mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(thread): implement CSRWLock::Enter and CSRWLock::Leave for windows (#1)
This commit is contained in:
parent
8210d368f6
commit
2fb9fd284c
5 changed files with 61 additions and 6 deletions
26
storm/thread/win/SRWLock.hpp
Normal file
26
storm/thread/win/SRWLock.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef STORM_THREAD_WIN_S_RW_LOCK_HPP
|
||||
#define STORM_THREAD_WIN_S_RW_LOCK_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SRWLock {
|
||||
public:
|
||||
// Types
|
||||
struct SUNNLOCK {
|
||||
int32_t m_state;
|
||||
int32_t m_event;
|
||||
};
|
||||
|
||||
struct SURWLOCK {
|
||||
SRWLock::SUNNLOCK m_mutex;
|
||||
int32_t m_readerEvent;
|
||||
};
|
||||
|
||||
// Static functions
|
||||
static void SUNNLockEnter(volatile SUNNLOCK* sunnlock);
|
||||
static void SUNNLockLeave(volatile SUNNLOCK* sunnlock);
|
||||
static void SURWLockEnter(volatile SURWLOCK* surwlock, int32_t forwriting);
|
||||
static void SURWLockLeave(volatile SURWLOCK* surwlock, int32_t fromwriting);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue