HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
subsystem.hpp File Reference

Functions for starting and stopping subsystems. More...

#include "../utility/utility.hpp"
#include "unfair_recursive_mutex.hpp"
#include "global_state.hpp"
#include "../macros.hpp"
#include <atomic>
#include <vector>
#include <functional>
#include <bit>
#include <type_traits>
#include <mutex>

Go to the source code of this file.

Namespaces

namespace  hi
 The HikoGUI namespace.
 
namespace  hi::v1
 The HikoGUI API version 1.
 

Functions

 hi_export_module (hikogui.concurrency.subsystem)
 
template<typename T >
requires (is_atomic_v<T>)
hi_no_inline T::value_type hi::v1::detail::start_subsystem (T &check_variable, typename T::value_type off_value, typename T::value_type(*init_function)(), void(*deinit_function)())
 
hi_no_inline bool hi::v1::detail::start_subsystem (global_state_type state_bit, bool(*init_function)(), void(*deinit_function)())
 
template<typename T >
requires (is_atomic_v<T>)
T::value_type hi::v1::start_subsystem (T &check_variable, typename T::value_type off_value, typename T::value_type(*init_function)(), void(*deinit_function)())
 Start a sub-system.
 
bool hi::v1::start_subsystem (global_state_type state_bit, bool(*init_function)(), void(*deinit_function)())
 Start a sub-system.
 
template<typename T >
requires (is_atomic_v<T>)
T::value_type hi::v1::start_subsystem_or_terminate (T &check_variable, typename T::value_type off_value, typename T::value_type(*init_function)(), void(*deinit_function)())
 Start a sub-system.
 
void hi::v1::stop_subsystem (void(*deinit_function)())
 Stop a sub-system.
 
void hi::v1::start_system () noexcept
 Start the system.
 
void hi::v1::shutdown_system () noexcept
 Shutdown the system.
 

Variables

std::vector< void(*)()> hi::v1::detail::subsystem_deinit_list
 A list of deinit function to be called on shutdown.
 
unfair_recursive_mutex hi::v1::detail::subsystem_mutex
 Mutex to be held when writing to system_status or accessing system_status_deinit_list.
 

Detailed Description

Functions for starting and stopping subsystems.

Variable Documentation

◆ subsystem_deinit_list

std::vector<void (*)()> hi::v1::detail::subsystem_deinit_list
inline

A list of deinit function to be called on shutdown.

◆ subsystem_mutex

unfair_recursive_mutex hi::v1::detail::subsystem_mutex
inline

Mutex to be held when writing to system_status or accessing system_status_deinit_list.

The system status is also an atomic variable so that reads on system_status without holding the mutex is still possible.