CommonLibSSE NG
BSAtomic.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "REX/W32/BASE.h"
4 
5 namespace RE
6 {
8  {
9  public:
10  // members
12  };
13  static_assert(sizeof(BSCriticalSection) == 0x28);
14 
16  {
17  public:
18  // members
19  void* event; // 0
20  };
21  static_assert(sizeof(BSEventFlag) == 0x8);
22 
24  {
25  public:
26  // members
27  volatile std::uint32_t lock; // 0
28  };
29  static_assert(sizeof(BSNonReentrantSpinLock) == 0x4);
30 
32  {
33  public:
36 
37  // members
38  void* semaphore; // 0
39  };
40  static_assert(sizeof(BSSemaphoreBase) == 0x8);
41 
43  {
44  public:
45  BSSemaphore() = default;
46  ~BSSemaphore() = default;
47  };
48  static_assert(sizeof(BSSemaphore) == 0x8);
49 
50  class BSSpinLock
51  {
52  public:
53  enum
54  {
56  };
57 
59 
60  void Lock(std::uint32_t a_pauseAttempts = 0);
61  void Unlock();
62 
63  private:
64  // members
65  volatile std::uint32_t _owningThread; // 0
66  volatile std::uint32_t _lockCount; // 4
67  };
68  static_assert(sizeof(BSSpinLock) == 0x8);
69 
71  {
72  public:
73  enum
74  {
75  kLockWrite = 0x80000000,
76  kLockCountMask = 0xFFFFFFF
77  };
78 
80 
81  void LockForRead();
82  void UnlockForRead();
83  void LockForWrite();
85 
86  private:
87  // members
88  [[maybe_unused]] volatile std::uint32_t _writerThread; // 0
89  [[maybe_unused]] volatile std::uint32_t _lock; // 4
90  };
91  static_assert(sizeof(BSReadWriteLock) == 0x8);
92 
94  {
95  public:
96  BSSpinLockGuard() = delete;
97  BSSpinLockGuard(const BSSpinLockGuard&) = delete;
99  [[nodiscard]] explicit BSSpinLockGuard(BSSpinLock& a_lock);
101 
104 
105  private:
106  BSSpinLock& _lock; // 0
107  };
108  static_assert(sizeof(BSSpinLockGuard) == 0x8);
109 
111  {
112  public:
113  BSReadLockGuard() = delete;
116  [[nodiscard]] explicit BSReadLockGuard(BSReadWriteLock& a_lock);
118 
121 
122  private:
123  BSReadWriteLock& _lock; // 0
124  };
125  static_assert(sizeof(BSReadLockGuard) == 0x8);
126 
128  {
129  public:
130  BSWriteLockGuard() = delete;
133  [[nodiscard]] explicit BSWriteLockGuard(BSReadWriteLock& a_lock);
135 
138 
139  private:
140  BSReadWriteLock& _lock; // 0
141  };
142  static_assert(sizeof(BSWriteLockGuard) == 0x8);
143 }
Definition: BSAtomic.h:8
REX::W32::CRITICAL_SECTION criticalSection
Definition: BSAtomic.h:11
Definition: BSAtomic.h:16
void * event
Definition: BSAtomic.h:19
Definition: BSAtomic.h:24
volatile std::uint32_t lock
Definition: BSAtomic.h:27
Definition: BSAtomic.h:111
BSReadLockGuard(BSReadLockGuard &&)=delete
BSReadLockGuard(BSReadWriteLock &a_lock)
BSReadLockGuard & operator=(BSReadLockGuard &&)=delete
BSReadLockGuard & operator=(const BSReadLockGuard &)=delete
BSReadLockGuard(const BSReadLockGuard &)=delete
BSReadLockGuard()=delete
Definition: BSAtomic.h:71
@ kLockCountMask
Definition: BSAtomic.h:76
@ kLockWrite
Definition: BSAtomic.h:75
Definition: BSAtomic.h:32
void * semaphore
Definition: BSAtomic.h:38
Definition: BSAtomic.h:43
BSSemaphore()=default
~BSSemaphore()=default
Definition: BSAtomic.h:94
BSSpinLockGuard(BSSpinLock &a_lock)
BSSpinLockGuard(const BSSpinLockGuard &)=delete
BSSpinLockGuard(BSSpinLockGuard &&)=delete
BSSpinLockGuard()=delete
BSSpinLockGuard & operator=(BSSpinLockGuard &&)=delete
BSSpinLockGuard & operator=(const BSSpinLockGuard &)=delete
Definition: BSAtomic.h:51
@ kFastSpinThreshold
Definition: BSAtomic.h:55
void Lock(std::uint32_t a_pauseAttempts=0)
Definition: BSAtomic.h:128
BSWriteLockGuard(const BSWriteLockGuard &)=delete
BSWriteLockGuard(BSReadWriteLock &a_lock)
BSWriteLockGuard & operator=(const BSWriteLockGuard &)=delete
BSWriteLockGuard & operator=(BSWriteLockGuard &&)=delete
BSWriteLockGuard(BSWriteLockGuard &&)=delete
Definition: AbsorbEffect.h:6
Definition: BASE.h:137