CommonLibSSE (Parapets fork)
BSAtomic.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
6  {
7  public:
8  // members
10  };
11  static_assert(sizeof(BSCriticalSection) == 0x28);
12 
14  {
15  public:
16  // members
17  void* event; // 0
18  };
19  static_assert(sizeof(BSEventFlag) == 0x8);
20 
22  {
23  public:
24  // members
25  volatile std::uint32_t lock; // 0
26  };
27  static_assert(sizeof(BSNonReentrantSpinLock) == 0x4);
28 
30  {
31  public:
34 
35  // members
36  void* semaphore; // 0
37  };
38  static_assert(sizeof(BSSemaphoreBase) == 0x8);
39 
41  {
42  public:
43  BSSemaphore() = default;
44  ~BSSemaphore() = default;
45  };
46  static_assert(sizeof(BSSemaphore) == 0x8);
47 
48  class BSSpinLock
49  {
50  public:
51  enum
52  {
54  };
55 
57 
58  void Lock(std::uint32_t a_pauseAttempts = 0);
59  void Unlock();
60 
61  private:
62  // members
63  volatile std::uint32_t _owningThread; // 0
64  volatile std::uint32_t _lockCount; // 4
65  };
66  static_assert(sizeof(BSSpinLock) == 0x8);
67 
69  {
70  public:
71  enum
72  {
73  kLockWrite = 0x80000000,
74  kLockCountMask = 0xFFFFFFF
75  };
76 
78 
79  void LockForRead();
80  void UnlockForRead();
81  void LockForWrite();
83 
84  private:
85  // members
86  volatile std::uint32_t _writerThread; // 0
87  volatile std::uint32_t _lock; // 4
88  };
89  static_assert(sizeof(BSReadWriteLock) == 0x8);
90 
92  {
93  public:
94  BSSpinLockGuard() = delete;
95  BSSpinLockGuard(const BSSpinLockGuard&) = delete;
97  explicit BSSpinLockGuard(BSSpinLock& a_lock);
99 
102 
103  private:
104  BSSpinLock& _lock; // 0
105  };
106  static_assert(sizeof(BSSpinLockGuard) == 0x8);
107 
109  {
110  public:
111  BSReadLockGuard() = delete;
114  explicit BSReadLockGuard(BSReadWriteLock& a_lock);
116 
119 
120  private:
121  BSReadWriteLock& _lock; // 0
122  };
123  static_assert(sizeof(BSReadLockGuard) == 0x8);
124 
126  {
127  public:
128  BSWriteLockGuard() = delete;
133 
136 
137  private:
138  BSReadWriteLock& _lock; // 0
139  };
140  static_assert(sizeof(BSWriteLockGuard) == 0x8);
141 }
Definition: BSAtomic.h:6
WinAPI::CRITICAL_SECTION criticalSection
Definition: BSAtomic.h:9
Definition: BSAtomic.h:14
void * event
Definition: BSAtomic.h:17
Definition: BSAtomic.h:22
volatile std::uint32_t lock
Definition: BSAtomic.h:25
Definition: BSAtomic.h:109
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:69
@ kLockCountMask
Definition: BSAtomic.h:74
@ kLockWrite
Definition: BSAtomic.h:73
Definition: BSAtomic.h:30
void * semaphore
Definition: BSAtomic.h:36
Definition: BSAtomic.h:41
BSSemaphore()=default
~BSSemaphore()=default
Definition: BSAtomic.h:92
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:49
void Lock(std::uint32_t a_pauseAttempts=0)
@ kFastSpinThreshold
Definition: BSAtomic.h:53
Definition: BSAtomic.h:126
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: WinAPI.h:14