[*] RWLock: "I didn't like what I saw emitted" cont

This commit is contained in:
Reece Wilson 2024-04-30 22:57:45 +01:00
parent 07ef822bfa
commit c79a709f96
2 changed files with 7 additions and 7 deletions

View File

@ -13,10 +13,13 @@
namespace Aurora::Threading::Primitives namespace Aurora::Threading::Primitives
{ {
/* static const AuUInt8 ... = ...; */ #define kOffsetOfRead AuOffsetOf(&RWLockImpl<true>::read_)
/* static const AuUInt8 ... = ...; */ #define kOffsetOfWrite AuOffsetOf(&RWLockImpl<true>::write_)
#if defined(RWLOCK_VIEW_HAS_PARENT) #if defined(RWLOCK_VIEW_HAS_PARENT)
#define ViewParent (&this->parent_) #define ViewParent (&this->parent_)
#else #else
#define ViewParent ((T *)(((char *)this) - (bIsReadView ? RWLockImpl<true>::kOffsetOfRead : RWLockImpl<true>::kOffsetOfWrite))) #define ViewParent ((T *)(((char *)this) - (bIsReadView ? kOffsetOfRead : kOffsetOfWrite)))
#endif #endif
#define RWLockAcquire AU_LOCK_GUARD(this->mutex_); #define RWLockAcquire AU_LOCK_GUARD(this->mutex_);

View File

@ -104,10 +104,11 @@ namespace Aurora::Threading::Primitives
auline AuUInt32 *GetReadSleepCounter(); auline AuUInt32 *GetReadSleepCounter();
private: public: // "private"
RWLockAccessView<true, RWLockImpl> read_; RWLockAccessView<true, RWLockImpl> read_;
RWLockAccessView<false, RWLockImpl> write_; RWLockAccessView<false, RWLockImpl> write_;
private:
ConditionMutexInternal mutex_; ConditionMutexInternal mutex_;
#if defined(AURWLOCK_NO_SIZE_OPTIMIZED_CONDVAR) #if defined(AURWLOCK_NO_SIZE_OPTIMIZED_CONDVAR)
ConditionVariableInternal condition_; ConditionVariableInternal condition_;
@ -120,9 +121,5 @@ namespace Aurora::Threading::Primitives
AuAInt32 iState_ {}; AuAInt32 iState_ {};
AuAInt32 dwWritersPending_ {}; AuAInt32 dwWritersPending_ {};
public:
cstatic const AuUInt8 kOffsetOfRead = AuOffsetOf(&RWLockImpl::read_);
cstatic const AuUInt8 kOffsetOfWrite = AuOffsetOf(&RWLockImpl::write_);
}; };
} }