MySQL 8.0.40
Source Code Documentation
CountDownLatch Class Reference

Synchronization auxiliary class that allows one or more threads to wait on a given number of requirements. More...

#include <plugin_utils.h>

Public Member Functions

 CountDownLatch (uint count)
 Create the latch with the number of requirements to wait. More...
 
virtual ~CountDownLatch ()
 
void wait (ulong timeout=0)
 Block until the number of requirements reaches zero. More...
 
void countDown ()
 Decrease the number of requirements by one. More...
 
uint getCount ()
 Get current number requirements. More...
 
void set_error ()
 Set error flag, once this latch is release the waiter can check if it was due to a error or due to correct termination. More...
 
bool get_error ()
 Get latch release reason. More...
 

Private Attributes

mysql_mutex_t lock
 
mysql_cond_t cond
 
int count
 
bool error
 

Detailed Description

Synchronization auxiliary class that allows one or more threads to wait on a given number of requirements.

Usage: CountDownLatch(count): Create the latch with the number of requirements to wait. wait(): Block until the number of requirements reaches zero. countDown(): Decrease the number of requirements by one.

Constructor & Destructor Documentation

◆ CountDownLatch()

CountDownLatch::CountDownLatch ( uint  count)
inline

Create the latch with the number of requirements to wait.

Parameters
countThe number of requirements to wait

◆ ~CountDownLatch()

virtual CountDownLatch::~CountDownLatch ( )
inlinevirtual

Member Function Documentation

◆ countDown()

void CountDownLatch::countDown ( )
inline

Decrease the number of requirements by one.

◆ get_error()

bool CountDownLatch::get_error ( )
inline

Get latch release reason.

Returns
true the latch was released due to a error false the latch was released on correct termination

◆ getCount()

uint CountDownLatch::getCount ( )
inline

Get current number requirements.

Returns
the number of requirements

◆ set_error()

void CountDownLatch::set_error ( )
inline

Set error flag, once this latch is release the waiter can check if it was due to a error or due to correct termination.

◆ wait()

void CountDownLatch::wait ( ulong  timeout = 0)
inline

Block until the number of requirements reaches zero.

Member Data Documentation

◆ cond

mysql_cond_t CountDownLatch::cond
private

◆ count

int CountDownLatch::count
private

◆ error

bool CountDownLatch::error
private

◆ lock

mysql_mutex_t CountDownLatch::lock
private

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