MySQL 8.0.40
Source Code Documentation
|
Ticket register/wait auxiliary class. More...
#include <plugin_utils.h>
Public Member Functions | |
Wait_ticket () | |
virtual | ~Wait_ticket () |
void | clear () |
bool | empty () |
Check if there are waiting tickets. More... | |
int | registerTicket (const K &key) |
Register ticker with status ongoing. More... | |
int | waitTicket (const K &key, ulong timeout=0) |
Wait until ticket status is done. More... | |
int | releaseTicket (const K &key, bool release_due_to_error=false) |
Set ticket status to done. More... | |
void | get_all_waiting_keys (std::vector< K > &key_list) |
Gets all the waiting keys. More... | |
void | set_blocked_status (bool blocked_flag) |
Blocks or unblocks the class from receiving waiting requests. More... | |
int | block_until_empty (int timeout) |
Private Attributes | |
mysql_mutex_t | lock |
mysql_cond_t | cond |
std::map< K, CountDownLatch * > | map |
bool | blocked |
bool | waiting |
Ticket register/wait auxiliary class.
Usage: registerTicket(k): create a ticket with key k with status ongoing. releaseTicket(k): set ticket with key k status to done. waitTicket(k): wait until ticket with key k status is changed to done.
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
Check if there are waiting tickets.
true | empty |
false | otherwise |
|
inline |
Gets all the waiting keys.
[out] | key_list | all the keys to return |
|
inline |
Register ticker with status ongoing.
key | The key that identifies the ticket |
0 | success |
!=0 | key already exists, error on insert or it is blocked |
|
inline |
Set ticket status to done.
key | The key that identifies the ticket |
release_due_to_error | Inform the thread waiting that the release is due to a error |
0 | success |
!=0 | (key doesn't exist) |
|
inline |
Blocks or unblocks the class from receiving waiting requests.
[in] | blocked_flag | if the class should block or not |
|
inline |
Wait until ticket status is done.
key | The key that identifies the ticket |
timeout | maximum time in seconds to wait by default is 0, which means no timeout |
0 | success |
!=0 | key doesn't exist, or the Ticket is blocked |
|
private |
|
private |
|
private |
|
private |
|
private |