QuantumLibrary
Bloomberg::quantum::Mutex::ReverseGuard Class Reference

#include <quantum_mutex.h>

Public Member Functions

 ReverseGuard (Mutex &mutex)
 Construct this object and unlock the passed-in mutex. More...
 
 ReverseGuard (ICoroSync::Ptr sync, Mutex &mutex)
 Construct this object and unlock the passed-in mutex. More...
 
 ~ReverseGuard ()
 Destroys this object and locks the underlying mutex. More...
 

Constructor & Destructor Documentation

◆ ReverseGuard() [1/2]

Mutex::ReverseGuard::ReverseGuard ( Mutex mutex)
inlineexplicit

Construct this object and unlock the passed-in mutex.

Parameters
[in]mutexMutex which remains unlocked during the lifetime of this object.
Note
This constructor must be used in a non-coroutine context.
Warning
Wrongfully calling this method from a coroutine will block all coroutines running in the same queue when this object is destroyed and thus result in noticeable performance degradation.

◆ ReverseGuard() [2/2]

Mutex::ReverseGuard::ReverseGuard ( ICoroSync::Ptr  sync,
Mutex mutex 
)
inline

Construct this object and unlock the passed-in mutex.

Parameters
[in]syncPointer to a coroutine synchronization object.
[in]mutexMutex which remains unlocked during the lifetime of this object.
Note
This constructor must be used in a coroutine context.

◆ ~ReverseGuard()

Mutex::ReverseGuard::~ReverseGuard ( )
inline

Destroys this object and locks the underlying mutex.