MySQL 8.4.2
Source Code Documentation
mysql_harness::LogReopen Class Reference

#include <log_reopen.h>

Classes

class  ThreadState
 

Public Types

using reopen_callback = std::function< void(const std::string &)>
 

Public Member Functions

 LogReopen ()
 
 ~LogReopen ()
 destruct the thread. More...
 
void request_reopen (const std::string &dst="")
 notify a "log_reopen" is requested with optional filename for old logfile. More...
 
bool completed () const
 check reopen completed More...
 
std::string get_last_error () const
 get last log reopen error More...
 
void set_complete_callback (reopen_callback cb)
 Setter for the log reopen thread completion callback function. More...
 

Private Member Functions

void stop ()
 stop the log_reopen_thread_function. More...
 
void join ()
 join the log_reopen thread. More...
 

Static Private Member Functions

static void main_loop (LogReopen *self)
 

Private Attributes

std::thread reopen_thr_
 
Monitor< reopen_callbackcomplete_callback_ {{}}
 
WaitableMonitor< ThreadStatethread_state_ {{}}
 

Friends

void main_loop (LogReopen *self)
 

Member Typedef Documentation

◆ reopen_callback

using mysql_harness::LogReopen::reopen_callback = std::function<void(const std::string &)>

Constructor & Destructor Documentation

◆ LogReopen()

mysql_harness::LogReopen::LogReopen ( )
inline

◆ ~LogReopen()

mysql_harness::LogReopen::~LogReopen ( )

destruct the thread.

Same as std::thread it may call std::terminate in case the thread isn't joined yet, but joinable.

In case join() fails as best-effort, a log-message is attempted to be written.

Member Function Documentation

◆ completed()

bool mysql_harness::LogReopen::completed ( ) const

check reopen completed

◆ get_last_error()

std::string mysql_harness::LogReopen::get_last_error ( ) const

get last log reopen error

◆ join()

void mysql_harness::LogReopen::join ( )
private

join the log_reopen thread.

Exceptions
std::system_errorsame as std::thread::join

◆ main_loop()

void mysql_harness::LogReopen::main_loop ( LogReopen self)
staticprivate

◆ request_reopen()

void mysql_harness::LogReopen::request_reopen ( const std::string &  dst = "")

notify a "log_reopen" is requested with optional filename for old logfile.

Parameters
dstrename old logfile to filename before reopen
Exceptions
std::system_errorsame as std::unique_lock::lock does

◆ set_complete_callback()

void mysql_harness::LogReopen::set_complete_callback ( LogReopen::reopen_callback  cb)

Setter for the log reopen thread completion callback function.

Parameters
cbFunction to call at completion.

◆ stop()

void mysql_harness::LogReopen::stop ( )
private

stop the log_reopen_thread_function.

Friends And Related Function Documentation

◆ main_loop

void main_loop ( LogReopen self)
friend

Member Data Documentation

◆ complete_callback_

Monitor<reopen_callback> mysql_harness::LogReopen::complete_callback_ {{}}
private

◆ reopen_thr_

std::thread mysql_harness::LogReopen::reopen_thr_
private

◆ thread_state_

WaitableMonitor<ThreadState> mysql_harness::LogReopen::thread_state_ {{}}
private

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