84 void (*do_func)(
void *),
void *do_func_arg) {
91 if (state->compare_exchange_strong(never_done,
IN_PROGRESS)) {
97 const bool swapped = state->compare_exchange_strong(in_progress,
DONE);
119#ifndef UNIV_HOTBACKUP
Execute a given function exactly once in a multi-threaded environment or wait for the function to be ...
Definition: os0once.h:64
static void do_or_wait_for_done(std::atomic< state_t > *state, void(*do_func)(void *), void *do_func_arg)
Call a given function or wait its execution to complete if it is already called by another thread.
Definition: os0once.h:83
static const state_t NEVER_DONE
Not yet executed.
Definition: os0once.h:70
static const state_t DONE
Finished execution.
Definition: os0once.h:76
static const state_t IN_PROGRESS
Currently being executed by this or another thread.
Definition: os0once.h:73
uint32_t state_t
Control variables' state type.
Definition: os0once.h:67
Macros for using atomics.
Version control for database, common definitions, and include files.
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
#define UT_RELAX_CPU()
Definition: ut0ut.h:93