60 std::shared_ptr<std::atomic<State>>
m_state;
62 void init(std::promise<void> &promise);
92template <
typename T_thing,
typename T_digit>
107 memcpy(buff, &
id,
sizeof(T_thing));
110 memcpy(&x, buff + i *
sizeof(T_digit),
sizeof(T_digit));
122 for (
size_t i = 0; i <
acc.size(); ++i) {
123 T_digit x =
acc[i].load(std::memory_order_acquire);
124 memcpy(buff + i *
sizeof(T_digit), &x,
sizeof(T_digit));
126 memcpy(&res, buff,
sizeof(T_thing));
132 (
sizeof(T_thing) +
sizeof(T_digit) - 1) /
sizeof(T_digit);
149 Scoped_event() : m_event(CreateEvent(
nullptr,
TRUE,
FALSE,
nullptr)) {
158 if (m_event !=
NULL) {
159 CloseHandle(m_event);
163 HANDLE get_handle()
const {
return m_event; }
173 std::conditional<
sizeof(
std::thread::id) >=
sizeof(uint64_t), uint64_t,
A class to allow any trivially copyable object to be XOR'ed.
Definition: os0thread.h:93
static constexpr size_t digits_count
Definition: os0thread.h:131
T_thing recover_if_single()
Returns an object that was XOR'ed odd number of times.
Definition: os0thread.h:119
Atomic_xor_of_things()
Definition: os0thread.h:95
void xor_thing(T_thing id)
Definition: os0thread.h:103
std::array< std::atomic< T_digit >, digits_count > acc
Definition: os0thread.h:136
Wrapper for a callable, it will count the number of registered Runnable instances and will register t...
Definition: os0thread-create.h:165
Definition: os0thread.h:46
void set_state(State state)
Definition: os0thread.cc:103
std::shared_ptr< std::atomic< State > > m_state
Definition: os0thread.h:60
std::shared_future< void > m_shared_future
Definition: os0thread.h:59
void init(std::promise< void > &promise)
Definition: os0thread.cc:98
State
Definition: os0thread.h:48
void wait(State state_to_wait_for=State::STOPPED)
Definition: os0thread.cc:85
void start()
Definition: os0thread.cc:58
void join()
Definition: os0thread.cc:96
State state() const
Definition: os0thread.h:50
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:41
static my_thread_id thread_id
Definition: my_thr_init.cc:63
int native_handle_type
Definition: socket_constants.h:51
pid_type get_id()
Definition: process.h:48
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
const thread_local size_t this_thread_hash
The hash value of the current thread's id.
Definition: os0thread.h:73
std::conditional< sizeof(std::thread::id) >=sizeof(uint64_t), uint64_t, uint32_t >::type Xor_digit_for_thread_id
A type for std::thread::id digit to store XOR efficiently.
Definition: os0thread.h:174
std::thread::native_handle_type os_thread_id_t
Operating system thread native handle.
Definition: os0thread.h:69
std::string to_string(std::thread::id thread_id, bool hex_value=false)
Returns the string representation of the thread ID supplied.
Definition: os0thread.cc:108
required string type
Definition: replication_group_member_actions.proto:34
#define NULL
Definition: types.h:55
#define TRUE
Definition: types.h:51
#define FALSE
Definition: types.h:47
Utilities related to class lifecycle.
Debug utilities for Innobase.
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:57
#define HANDLE
Definition: violite.h:159
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510