MySQL 8.0.40
Source Code Documentation
binlog::AtomicBgcTicket Class Reference

Implements atomic ops on BgcTicket object. More...

#include <atomic_bgc_ticket.h>

Public Member Functions

virtual ~AtomicBgcTicket ()=default
 
 AtomicBgcTicket (AtomicBgcTicket const &)=delete
 
 AtomicBgcTicket (AtomicBgcTicket &&)=delete
 
AtomicBgcTicketoperator= (AtomicBgcTicket const &)=delete
 
AtomicBgcTicketoperator= (AtomicBgcTicket &&)=delete
 
 AtomicBgcTicket (const BgcTicket &src)
 Copying ctor. More...
 
 AtomicBgcTicket (const BgcTicket::ValueType &src)
 Copying ctor. More...
 
AtomicBgcTicketGuard scoped_lock (bool inc_next_before_release=false)
 Creates the "lock" that is held for the returned AtomicBgcTicketGuard object lifetime. More...
 
AtomicBgcTicketGuard scoped_lock (const BgcTicket &next_value)
 Creates the "lock" that is held for the returned AtomicBgcTicketGuard object lifetime. More...
 
void store (const BgcTicket &value)
 Ticket mutator, atomic store op. More...
 
BgcTicket load () const
 Ticket accessor, atomic load op. More...
 

Protected Member Functions

std::pair< BgcTicket, BgcTicketset_in_use (bool inc_next_before_acquire=false, bool inc_next_before_release=false)
 Sets ticket synchronization value to "in use". More...
 
void set_used (const BgcTicket &next_value)
 Sets ticket synchronization value to "used/free". More...
 

Protected Attributes

memory::Aligned_atomic< BgcTicket::ValueTypem_ticket
 internal ticket representation More...
 

Friends

class AtomicBgcTicketGuard
 
class BgcTicket
 
std::ostream & operator<< (std::ostream &os, const AtomicBgcTicket &arg)
 Stream operator impl for AtomicBgcTicket class. More...
 

Detailed Description

Implements atomic ops on BgcTicket object.

Impl based on Aligned_atomic

See also
Bgc_ticket_manager

Constructor & Destructor Documentation

◆ ~AtomicBgcTicket()

virtual binlog::AtomicBgcTicket::~AtomicBgcTicket ( )
virtualdefault

◆ AtomicBgcTicket() [1/4]

binlog::AtomicBgcTicket::AtomicBgcTicket ( AtomicBgcTicket const &  )
delete

◆ AtomicBgcTicket() [2/4]

binlog::AtomicBgcTicket::AtomicBgcTicket ( AtomicBgcTicket &&  )
delete

◆ AtomicBgcTicket() [3/4]

binlog::AtomicBgcTicket::AtomicBgcTicket ( const BgcTicket src)

Copying ctor.

Parameters
[in]srcPattern to copy from

AtomicBgcTicket is created based on src BgcTicket object

◆ AtomicBgcTicket() [4/4]

binlog::AtomicBgcTicket::AtomicBgcTicket ( const BgcTicket::ValueType src)
explicit

Copying ctor.

Parameters
[in]srcPattern to copy from

AtomicBgcTicket is created based on src ValueType object

Member Function Documentation

◆ load()

BgcTicket binlog::AtomicBgcTicket::load ( ) const

Ticket accessor, atomic load op.

Returns
BGC Ticket obtained during the atomic load op

◆ operator=() [1/2]

AtomicBgcTicket & binlog::AtomicBgcTicket::operator= ( AtomicBgcTicket &&  )
delete

◆ operator=() [2/2]

AtomicBgcTicket & binlog::AtomicBgcTicket::operator= ( AtomicBgcTicket const &  )
delete

◆ scoped_lock() [1/2]

AtomicBgcTicketGuard binlog::AtomicBgcTicket::scoped_lock ( bool  inc_next_before_release = false)

Creates the "lock" that is held for the returned AtomicBgcTicketGuard object lifetime.

Parameters
[in]inc_next_before_releaseBefore "release" operation, ticket value is set to the value+1 in case inc_next_before_acquire is equal false and inc_next_before_release is equal to true

◆ scoped_lock() [2/2]

AtomicBgcTicketGuard binlog::AtomicBgcTicket::scoped_lock ( const BgcTicket next_value)

Creates the "lock" that is held for the returned AtomicBgcTicketGuard object lifetime.

◆ set_in_use()

std::pair< BgcTicket, BgcTicket > binlog::AtomicBgcTicket::set_in_use ( bool  inc_next_before_acquire = false,
bool  inc_next_before_release = false 
)
protected

Sets ticket synchronization value to "in use".

Only one thread is allowed to get into the critical section that starts with the "set_in_use" op and ends with the "set_used"

Parameters
[in]inc_next_before_acquireDuring the "acquire" operation, ticket value is set to the value+1 in case inc_next_before_acquire is equal to true.
[in]inc_next_before_releaseBefore "release" operation, ticket value is set to the value+1 in case inc_next_before_acquire is equal false.
Returns
previous ticket value (obtained before acquire op) and next ticket value (set before release op)

◆ set_used()

void binlog::AtomicBgcTicket::set_used ( const BgcTicket next_value)
protected

Sets ticket synchronization value to "used/free".

Only one thread is allowed to get into the critical section that starts with the "set_in_use" op and ends with the "set_used"

Parameters
[in]next_valueNext ticket value set during the "release" op.

◆ store()

void binlog::AtomicBgcTicket::store ( const BgcTicket value)

Ticket mutator, atomic store op.

Parameters
[in]valueSets atomically m_ticket internal variable to "value"

Friends And Related Function Documentation

◆ AtomicBgcTicketGuard

friend class AtomicBgcTicketGuard
friend

◆ BgcTicket

friend class BgcTicket
friend

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const AtomicBgcTicket arg 
)
friend

Stream operator impl for AtomicBgcTicket class.

Parameters
[in]osReference to stream obj
[in]argConstant reference to AtomicBgcTicket object
Returns
Reference to changed stream obj

Member Data Documentation

◆ m_ticket

memory::Aligned_atomic<BgcTicket::ValueType> binlog::AtomicBgcTicket::m_ticket
protected

internal ticket representation


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