[*] SafeDestroy: Use the atomic i noted in the issue
This commit is contained in:
parent
86673fbfb6
commit
a046eafdd5
@ -49,15 +49,10 @@ namespace AuUtil
|
||||
public: \
|
||||
virtual ~type() \
|
||||
{ \
|
||||
AuUInt32 uEndState, uCurrentState; \
|
||||
do \
|
||||
if (AuAtomicTestAndSet(&this->uCurrentState_, 2)) \
|
||||
{ \
|
||||
uCurrentState = this->uCurrentState_; \
|
||||
uEndState = uCurrentState; \
|
||||
if (uCurrentState & 2) return; \
|
||||
uEndState |= 2; \
|
||||
return; \
|
||||
} \
|
||||
while (AuAtomicCompareExchange(&this->uCurrentState_, uEndState, uCurrentState) != uCurrentState); \
|
||||
\
|
||||
type :: _TryPreDeconstruct<type>(this); \
|
||||
\
|
||||
@ -69,15 +64,10 @@ public: \
|
||||
\
|
||||
inline void Destroy() \
|
||||
{ \
|
||||
AuUInt32 uEndState, uCurrentState; \
|
||||
do \
|
||||
if (AuAtomicTestAndSet(&this->uCurrentState_, 1)) \
|
||||
{ \
|
||||
uCurrentState = this->uCurrentState_; \
|
||||
uEndState = uCurrentState; \
|
||||
if (uCurrentState & 1) return; \
|
||||
uEndState |= 1; \
|
||||
return; \
|
||||
} \
|
||||
while (AuAtomicCompareExchange(&this->uCurrentState_, uEndState, uCurrentState) != uCurrentState); \
|
||||
\
|
||||
type :: _TryDeconstructPrivate<type>(this); \
|
||||
} \
|
||||
|
Loading…
Reference in New Issue
Block a user