Monado OpenXR Runtime
|
Wrapper around OS functions and structs. More...
Modules | |
Portable Timekeeping | |
Unifying wrapper around system time retrieval functions. | |
Files | |
file | os_ble.h |
Wrapper around OS native BLE functions. | |
file | os_ble_dbus.c |
BLE implementation based on Linux Bluez/dbus. | |
file | os_ble_stubs.c |
Stub BLE functions. | |
file | os_documentation.h |
Documentation. | |
file | os_hid.h |
Wrapper around OS native hid functions. | |
file | os_hid_hidraw.c |
Hid implementation based on hidraw. | |
file | os_threading.h |
Wrapper around OS threading native functions. | |
file | os_time.cpp |
Wrapper around OS native time functions. | |
file | os_time.h |
Wrapper around OS native time functions. | |
file | u_windows.c |
Various helpers for doing Windows specific things. | |
file | u_windows.h |
Various helpers for doing Windows specific things. | |
Data Structures | |
struct | os_mutex |
A wrapper around a native mutex. More... | |
struct | os_cond |
A wrapper around a native conditional variable. More... | |
struct | os_thread |
A wrapper around a native thread. More... | |
struct | os_semaphore |
A wrapper around a native semaphore. More... | |
struct | os_thread_helper |
All in one helper that handles locking, waiting for change and starting a thread. More... | |
interface | os_ble_device |
Representing a single ble notify attribute on a device. More... | |
Typedefs | |
typedef void *(* | os_thread::os_run_func_t) (void *) |
Run function. More... | |
Functions | |
static XRT_MAYBE_UNUSED int | os_ble_read (struct os_ble_device *ble_dev, uint8_t *data, size_t size, int milliseconds) |
Read data from the ble file descriptor, if any, from the given bledevice. More... | |
static XRT_MAYBE_UNUSED void | os_ble_destroy (struct os_ble_device **ble_dev_ptr) |
Close and free the given device, does null checking and zeroing. More... | |
int | os_ble_notify_open (const char *dev_uuid, const char *char_uuid, struct os_ble_device **out_ble) |
Returns a notification endpoint from the given device uuid and char uuid. More... | |
int | os_ble_broadcast_write_value (const char *service_uuid, const char *char_uuid, uint8_t value) |
Returns write startpoints from the given device uuid and char uuid. More... | |
static int | os_mutex::os_mutex_init (struct os_mutex *om) |
Init. More... | |
static void | os_mutex::os_mutex_lock (struct os_mutex *om) |
Lock. More... | |
static int | os_mutex::os_mutex_trylock (struct os_mutex *om) |
Try to lock, but do not block. More... | |
static void | os_mutex::os_mutex_unlock (struct os_mutex *om) |
Unlock. More... | |
static void | os_mutex::os_mutex_destroy (struct os_mutex *om) |
Clean up. More... | |
static int | os_mutex::os_mutex_recursive_init (struct os_mutex *om) |
Init. More... | |
static void | os_mutex::os_mutex_recursive_destroy (struct os_mutex *om) |
Clean up. More... | |
static int | os_cond::os_cond_init (struct os_cond *oc) |
Init. More... | |
static void | os_cond::os_cond_signal (struct os_cond *oc) |
Signal. More... | |
static void | os_cond::os_cond_wait (struct os_cond *oc, struct os_mutex *om) |
Wait. More... | |
static void | os_cond::os_cond_destroy (struct os_cond *oc) |
Clean up. More... | |
static int | os_thread::os_thread_init (struct os_thread *ost) |
Init. More... | |
static int | os_thread::os_thread_start (struct os_thread *ost, os_run_func_t func, void *ptr) |
Start thread. More... | |
static void | os_thread::os_thread_join (struct os_thread *ost) |
Join. More... | |
static void | os_thread::os_thread_destroy (struct os_thread *ost) |
Destruction. More... | |
static void | os_thread::os_thread_name (struct os_thread *ost, const char *name) |
Make a best effort to name our thread. More... | |
static int | os_semaphore::os_semaphore_init (struct os_semaphore *os, int count) |
Init. More... | |
static void | os_semaphore::os_semaphore_release (struct os_semaphore *os) |
Release. More... | |
static int | os_semaphore::os_semaphore_get_realtime_clock (struct timespec *ts, uint64_t timeout_ns) |
Set ts to the current time, plus the timeout_ns value. More... | |
static void | os_semaphore::os_semaphore_wait (struct os_semaphore *os, uint64_t timeout_ns) |
Wait, if timeout_ns is zero then waits forever. More... | |
static void | os_semaphore::os_semaphore_destroy (struct os_semaphore *os) |
Clean up. More... | |
static int | os_thread_helper::os_thread_helper_init (struct os_thread_helper *oth) |
Initialize the thread helper. More... | |
static int | os_thread_helper::os_thread_helper_start (struct os_thread_helper *oth, os_run_func_t func, void *ptr) |
Start the internal thread. More... | |
static int | os_thread_helper::os_thread_helper_signal_stop (struct os_thread_helper *oth) |
Signal from within the thread that we are stopping. More... | |
static int | os_thread_helper::os_thread_helper_stop_and_wait (struct os_thread_helper *oth) |
Stop the thread and wait for it to exit. More... | |
static void | os_thread_helper::os_thread_helper_destroy (struct os_thread_helper *oth) |
Destroy the thread helper, externally synchronizable. More... | |
static void | os_thread_helper::os_thread_helper_lock (struct os_thread_helper *oth) |
Lock the helper. More... | |
static void | os_thread_helper::os_thread_helper_unlock (struct os_thread_helper *oth) |
Unlock the helper. More... | |
static bool | os_thread_helper::os_thread_helper_is_running (struct os_thread_helper *oth) |
Is the thread running, or supposed to be running. More... | |
static bool | os_thread_helper::os_thread_helper_is_running_locked (struct os_thread_helper *oth) |
Is the thread running, or supposed to be running. More... | |
static void | os_thread_helper::os_thread_helper_wait_locked (struct os_thread_helper *oth) |
Wait for a signal. More... | |
static void | os_thread_helper::os_thread_helper_signal_locked (struct os_thread_helper *oth) |
Signal a waiting thread to wake up. More... | |
static void | os_thread_helper::os_thread_helper_name (struct os_thread_helper *oth, const char *name) |
Make a best effort to name our thread. More... | |
Wrapper around OS functions and structs.
typedef void *(* os_run_func_t) (void *) |
Run function.
int os_ble_broadcast_write_value | ( | const char * | service_uuid, |
const char * | char_uuid, | ||
uint8_t | value | ||
) |
#include <auxiliary/os/os_ble.h>
Returns write startpoints from the given device uuid and char uuid.
|
inlinestatic |
#include <auxiliary/os/os_ble.h>
Close and free the given device, does null checking and zeroing.
int os_ble_notify_open | ( | const char * | dev_uuid, |
const char * | char_uuid, | ||
struct os_ble_device ** | out_ble | ||
) |
#include <auxiliary/os/os_ble.h>
Returns a notification endpoint from the given device uuid and char uuid.
References U_TYPED_CALLOC.
|
inlinestatic |
#include <auxiliary/os/os_ble.h>
Read data from the ble file descriptor, if any, from the given bledevice.
If milliseconds are negative, this call blocks indefinitely, 0 polls, and positive will block for that amount of milliseconds.
Referenced by arduino_read_one_packet(), and daydream_read_one_packet().
|
inlinestatic |
Clean up.
|
inlinestatic |
Init.
|
inlinestatic |
Signal.
Referenced by locked_pool_wake_worker_if_allowed().
Wait.
Be sure to call this in a loop, testing some other condition that you are actually waiting for, as condition variable waits are subject to spurious wakeups.
Must be called with the mutex om
locked.
Once the wait begins, the mutex om
is unlocked, to allow another thread access to change the thing you're monitoring. By the time this returns, you once again own the lock.
|
inlinestatic |
|
inlinestatic |
Init.
Referenced by sdl_program_plus_create(), u_native_images_debug_init(), and vk_init_mutex().
|
inlinestatic |
Lock.
Referenced by client_gl_compositor::client_gl_compositor_context_begin(), gui_window_record_close(), image_cleanup(), ipc_client_connection_lock(), ipc_server_activate_session(), ipc_server_client_destroy_session_and_compositor(), ipc_server_deactivate_session(), ipc_server_get_client_app_state(), ipc_server::ipc_server_handle_client_connected(), ipc_server_set_active_client(), ipc_server_toggle_io_client(), ipc_server_update_state(), partial_imu_sample_push(), xrt::auxiliary::tracking::slam::predict_pose_from_imu(), sdl_make_current(), u_native_images_debug_lock(), u_session::u_session_event_pop(), u_session::u_session_event_push(), u_system::u_system_add_session(), u_system::u_system_broadcast_event(), u_system::u_system_remove_session(), vk_cmd_pool::vk_cmd_pool_lock(), and vk_cmd_submit_locked().
|
inlinestatic |
Clean up.
|
inlinestatic |
Init.
|
inlinestatic |
Try to lock, but do not block.
|
inlinestatic |
Unlock.
Referenced by client_gl_compositor::client_gl_compositor_context_begin(), client_gl_compositor::client_gl_compositor_context_end(), gui_window_record_close(), image_cleanup(), ipc_client_connection_unlock(), sdl_make_uncurrent(), u_native_images_debug_unlock(), u_session::u_session_event_pop(), u_session::u_session_event_push(), u_system::u_system_add_session(), u_system::u_system_broadcast_event(), vk_cmd_pool::vk_cmd_pool_unlock(), and vk_cmd_submit_locked().
|
inlinestatic |
Clean up.
|
inlinestatic |
Set ts
to the current time, plus the timeout_ns value.
Intended for use by the threading code only: the timestamps are not interchangeable with other sources of time.
References os_ns_to_timespec(), and os_timespec_to_ns().
Referenced by os_semaphore::os_semaphore_wait().
|
inlinestatic |
Init.
|
inlinestatic |
Release.
|
inlinestatic |
Wait, if timeout_ns
is zero then waits forever.
References os_semaphore::os_semaphore_get_realtime_clock().
|
inlinestatic |
Destruction.
|
inlinestatic |
Destroy the thread helper, externally synchronizable.
Integrates a call to os_thread_helper_stop_and_wait, so you may just call this for full cleanup
References os_thread_helper::os_thread_helper_stop_and_wait().
Referenced by comp_window_mswin_destroy().
|
inlinestatic |
Initialize the thread helper.
References U_ZERO.
|
inlinestatic |
Is the thread running, or supposed to be running.
Call with mutex unlocked - it takes and releases the lock internally. If you already have a lock, use os_thread_helper_is_running_locked().
References os_thread_helper::os_thread_helper_lock(), and os_thread_helper::os_thread_helper_unlock().
|
inlinestatic |
Is the thread running, or supposed to be running.
Must be called with the helper locked. If you don't have the helper locked for some other reason already, you can use os_thread_helper_is_running()
Referenced by arduino_read_one_packet(), daydream_read_one_packet(), psmv_read_one_packet(), and pssense_read_one_packet().
|
inlinestatic |
Lock the helper.
Referenced by arduino_read_one_packet(), daydream_read_one_packet(), opengloves_read_next_packet(), os_thread_helper::os_thread_helper_is_running(), psmv_read_one_packet(), and pssense_read_one_packet().
|
inlinestatic |
Make a best effort to name our thread.
|
inlinestatic |
Signal a waiting thread to wake up.
Must be called with the helper locked.
|
inlinestatic |
Signal from within the thread that we are stopping.
Call with mutex unlocked - it takes and releases the lock internally.
|
inlinestatic |
Start the internal thread.
|
inlinestatic |
Stop the thread and wait for it to exit.
Call with mutex unlocked - it takes and releases the lock internally.
Referenced by os_thread_helper::os_thread_helper_destroy().
|
inlinestatic |
Unlock the helper.
Referenced by arduino_read_one_packet(), daydream_read_one_packet(), os_thread_helper::os_thread_helper_is_running(), psmv_read_one_packet(), and pssense_read_one_packet().
|
inlinestatic |
Wait for a signal.
Be sure to call this in a loop, testing some other condition that you are actually waiting for, as this is backed by a condition variable wait and is thus subject to spurious wakeups.
Must be called with the helper locked.
As this wraps a cond-var wait, once the wait begins, the helper is unlocked, to allow another thread access to change the thing you're monitoring. By the time this returns, you once again own the lock.
|
inlinestatic |
Init.
|
inlinestatic |
Make a best effort to name our thread.
|
inlinestatic |
Start thread.