59 std::shared_ptr<std::atomic<State>>
m_state;
61 void init(std::promise<void> &promise);
91template <
typename T_thing,
typename T_digit>
106 memcpy(buff, &
id,
sizeof(T_thing));
109 memcpy(&x, buff + i *
sizeof(T_digit),
sizeof(T_digit));
121 for (
size_t i = 0; i <
acc.size(); ++i) {
122 T_digit x =
acc[i].load(std::memory_order_acquire);
123 memcpy(buff + i *
sizeof(T_digit), &x,
sizeof(T_digit));
125 memcpy(&res, buff,
sizeof(T_thing));
131 (
sizeof(T_thing) +
sizeof(T_digit) - 1) /
sizeof(T_digit);
148 Scoped_event() : m_event(CreateEvent(
nullptr,
TRUE,
FALSE,
nullptr)) {
157 if (m_event !=
NULL) {
158 CloseHandle(m_event);
162 HANDLE get_handle()
const {
return m_event; }
172 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:92
static constexpr size_t digits_count
Definition: os0thread.h:130
T_thing recover_if_single()
Returns an object that was XOR'ed odd number of times.
Definition: os0thread.h:118
Atomic_xor_of_things()
Definition: os0thread.h:94
void xor_thing(T_thing id)
Definition: os0thread.h:102
std::array< std::atomic< T_digit >, digits_count > acc
Definition: os0thread.h:135
Wrapper for a callable, it will count the number of registered Runnable instances and will register t...
Definition: os0thread-create.h:166
Definition: os0thread.h:45
void set_state(State state)
Definition: os0thread.cc:102
std::shared_ptr< std::atomic< State > > m_state
Definition: os0thread.h:59
std::shared_future< void > m_shared_future
Definition: os0thread.h:58
void init(std::promise< void > &promise)
Definition: os0thread.cc:97
State
Definition: os0thread.h:47
void wait(State state_to_wait_for=State::STOPPED)
Definition: os0thread.cc:84
void start()
Definition: os0thread.cc:57
void join()
Definition: os0thread.cc:95
State state() const
Definition: os0thread.h:49
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:40
static my_thread_id thread_id
Definition: my_thr_init.cc:62
int native_handle_type
Definition: socket_constants.h:50
pid_type get_id()
Definition: process.h:47
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:47
const thread_local size_t this_thread_hash
The hash value of the current thread's id.
Definition: os0thread.h:72
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:173
std::thread::native_handle_type os_thread_id_t
Operating system thread native handle.
Definition: os0thread.h:68
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:107
required string type
Definition: replication_group_member_actions.proto:33
#define NULL
Definition: types.h:54
#define TRUE
Definition: types.h:50
#define FALSE
Definition: types.h:46
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:56
#define HANDLE
Definition: violite.h:158
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:509