MySQL 9.0.0
Source Code Documentation
resource_blocker::Blocker Class Reference

#include <resource_blocker.h>

Public Member Functions

 Blocker ()
 By default, does not block any Resource. More...
 
 Blocker (Resource &resource, const std::string &reason)
 Attempt to start using the given Resource. More...
 
 Blocker (Blocker &other)
 Block the same Resource that other blocks, if any. More...
 
 Blocker (Blocker &&other) noexcept
 Take over the Resource that other blocks, if any. More...
 
Blockeroperator= (Blocker const &other)
 Release our own Resource, if any, and then block the same Resource that other blocks, if any. More...
 
Blockeroperator= (Blocker &&other) noexcept
 Release our own resource, if any, and then steal the Resource that other blocks, if any, so that other does not block it any more. More...
 
 operator bool ()
 Return true if we block the Resource. More...
 
bool operator! ()
 Return false if we block the Resource. More...
 
int user_count () const
 Return the number of users of the Resource at the time we tried to block it. More...
 
void end_block ()
 Stop blocking the Resource, if we do. More...
 
 ~Blocker ()
 Stop holding the Resource in 'used' state, if we do. More...
 

Private Attributes

Resourcem_resource
 
std::string m_reason
 
int m_user_count
 

Constructor & Destructor Documentation

◆ Blocker() [1/4]

resource_blocker::Blocker::Blocker ( )
inline

By default, does not block any Resource.

◆ Blocker() [2/4]

resource_blocker::Blocker::Blocker ( Resource resource,
const std::string &  reason 
)
inline

Attempt to start using the given Resource.

This may fail, so the caller must check if it succeeded or not, using operator bool or operator!.

◆ Blocker() [3/4]

resource_blocker::Blocker::Blocker ( Blocker other)
inline

Block the same Resource that other blocks, if any.

◆ Blocker() [4/4]

resource_blocker::Blocker::Blocker ( Blocker &&  other)
inlinenoexcept

Take over the Resource that other blocks, if any.

◆ ~Blocker()

resource_blocker::Blocker::~Blocker ( )
inline

Stop holding the Resource in 'used' state, if we do.

Member Function Documentation

◆ end_block()

void resource_blocker::Blocker::end_block ( )
inline

Stop blocking the Resource, if we do.

◆ operator bool()

resource_blocker::Blocker::operator bool ( )
inlineexplicit

Return true if we block the Resource.

◆ operator!()

bool resource_blocker::Blocker::operator! ( )
inline

Return false if we block the Resource.

◆ operator=() [1/2]

Blocker & resource_blocker::Blocker::operator= ( Blocker &&  other)
inlinenoexcept

Release our own resource, if any, and then steal the Resource that other blocks, if any, so that other does not block it any more.

◆ operator=() [2/2]

Blocker & resource_blocker::Blocker::operator= ( Blocker const &  other)
inline

Release our own Resource, if any, and then block the same Resource that other blocks, if any.

◆ user_count()

int resource_blocker::Blocker::user_count ( ) const
inline

Return the number of users of the Resource at the time we tried to block it.

Member Data Documentation

◆ m_reason

std::string resource_blocker::Blocker::m_reason
private

◆ m_resource

Resource* resource_blocker::Blocker::m_resource
private

◆ m_user_count

int resource_blocker::Blocker::m_user_count
private

The documentation for this class was generated from the following file: