8#include "console_win32.hpp"
9#include "debugger_intf.hpp"
20hi_export_module(hikogui.utility.initialize);
22hi_export
namespace hi {
26enum class initialize_state_type {
32inline thread_local uint16_t initialize_thread_id_dummy;
37[[nodiscard]]
inline uintptr_t initialize_thread_id() noexcept
42 return std::bit_cast<uintptr_t>(
std::addressof(initialize_thread_id_dummy));
58 using namespace std::literals;
60 uintptr_t expected = 0;
61 if (detail::initialize_state.compare_exchange_strong(expected, detail::initialize_thread_id(), std::memory_order::acquire)) {
76 detail::initialize_state.store(1, std::memory_order::release);
78 }
else if (expected == detail::initialize_thread_id()) {
79 set_debug_message(
"hi::initialize() re-enterred from same thread.");
85 while (detail::initialize_state.
load(std::memory_order::acquire) != 1) {
Utilities for throwing exceptions and terminating the application.
The HikoGUI namespace.
Definition array_generic.hpp:20
std::terminate_handler old_terminate_handler
The old terminate handler.
Definition terminate.hpp:58
void enable_debugger() noexcept
Enable the JIT debugger to be attached.
Definition debugger_generic_impl.hpp:17
void start_console() noexcept
Start the console.
Definition console_win32.hpp:21
void initialize() noexcept
Initialize base functionality of HikoGUI.
Definition initialize.hpp:56
constexpr Out load(In const *src) noexcept
Unaligned Load of a numeric value from an array.
Definition endian.hpp:80
void terminate_handler() noexcept
The HikoGUI terminate handler.
Definition terminate.hpp:66
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
T set_terminate(T... args)