61 std::shared_ptr<std::atomic<State>>
m_state;
63 void init(std::promise<void> &promise);
93template <
typename T_thing,
typename T_digit>
108 memcpy(buff, &
id,
sizeof(T_thing));
111 memcpy(&x, buff + i *
sizeof(T_digit),
sizeof(T_digit));
123 for (
size_t i = 0; i <
acc.size(); ++i) {
124 T_digit x =
acc[i].load(std::memory_order_acquire);
125 memcpy(buff + i *
sizeof(T_digit), &x,
sizeof(T_digit));
127 memcpy(&res, buff,
sizeof(T_thing));
150 Scoped_event() : m_event(CreateEvent(
nullptr,
TRUE,
FALSE,
nullptr)) {
156 ut_a(m_event !=
nullptr);
159 if (m_event !=
nullptr) {
160 CloseHandle(m_event);
164 HANDLE get_handle()
const {
return m_event; }
174 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:94
static constexpr size_t digits_count
Definition: os0thread.h:132
T_thing recover_if_single()
Returns an object that was XOR'ed odd number of times.
Definition: os0thread.h:120
Atomic_xor_of_things()
Definition: os0thread.h:96
void xor_thing(T_thing id)
Definition: os0thread.h:104
std::array< std::atomic< T_digit >, digits_count > acc
Definition: os0thread.h:137
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:47
void set_state(State state)
Definition: os0thread.cc:103
std::shared_ptr< std::atomic< State > > m_state
Definition: os0thread.h:61
std::shared_future< void > m_shared_future
Definition: os0thread.h:60
void init(std::promise< void > &promise)
Definition: os0thread.cc:98
State
Definition: os0thread.h:49
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:51
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:74
constexpr T div_ceil(T numerator, T denominator)
Computes the result of division rounded towards positive infinity.
Definition: ut0math.h:49
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:175
std::thread::native_handle_type os_thread_id_t
Operating system thread native handle.
Definition: os0thread.h:70
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 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:93
#define HANDLE
Definition: violite.h:159
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510