WeakRefTargetBase Struct Reference

#include <weakref.h>

公共成员函数

const void *  () const
void  Unlock (const void *target) const
  operator Bool () const
const void *  GetCurrent () const
void  UnlockCurrent () const
void  Swap (const void *oldTarget, const void *newTarget)

Protected Attributes

AtomicUInt   _target

成员函数文档编制

◆  Lock()

const void* Lock ( ) const

Locks the WeakRefTarget.

注意
After locking you must unlock as soon as possible, especially calling any method with unknown behaviour can easily lead to a deadlock. THREADSAFE.
返回
Pointer to the current target.

◆  Unlock()

void Unlock ( const void *  target ) const

Unlocks the WeakRefTarget. THREADSAFE.

参数
[in] target Pointer to the (new) target to be stored.

◆  operator Bool()

operator Bool ( ) const
explicit

Checks if there currently is a target.

返回
True if there currently is a target, otherwise false.

◆  GetCurrent()

const void* GetCurrent ( ) const

Returns the current target pointer. Use Lock() and Unlock() to get a thread-safe pointer.

◆  UnlockCurrent()

void UnlockCurrent ( ) const

Unlocks the current target.

◆  Swap()

void Swap ( const void *  oldTarget ,
const void *  newTarget  
)

Swaps old and new target.

注意
Use only if oldTarget is guaranteed to be valid, otherwise this will result in a freeze.
参数
[in] oldTarget Pointer to the old target.
[in] newTarget Pointer to the new target to be stored.

Member Data Documentation

◆  _target

AtomicUInt _target
mutable protected