The open source OpenXR runtime
at main 65 lines 1.6 kB view raw
1// Copyright 2020-2023, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3/*! 4 * @file 5 * @brief More-internal client side code. 6 * @author Pete Black <pblack@collabora.com> 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 * @author Rylie Pavlik <rylie.pavlik@collabora.com> 9 * @ingroup ipc_client 10 */ 11 12#pragma once 13 14#include "xrt/xrt_results.h" 15#include "ipc_client.h" 16 17 18/*! 19 * Set up the basics of the client connection: socket and shared mem 20 * @param ipc_c Empty IPC connection struct 21 * @param log_level Log level for IPC messages 22 * @param i_info Instance info to send to server 23 * @return XRT_SUCCESS on success 24 * 25 * @ingroup ipc_client 26 */ 27xrt_result_t 28ipc_client_connection_init(struct ipc_connection *ipc_c, 29 enum u_logging_level log_level, 30 const struct xrt_instance_info *i_info); 31 32/*! 33 * Locks the connection, allows sending complex messages. 34 * 35 * @param ipc_c The IPC connection to lock. 36 * 37 * @ingroup ipc_client 38 */ 39static inline void 40ipc_client_connection_lock(struct ipc_connection *ipc_c) 41{ 42 os_mutex_lock(&ipc_c->mutex); 43} 44 45/*! 46 * Unlocks the connection. 47 * 48 * @param ipc_c A locked IPC connection to unlock. 49 * 50 * @ingroup ipc_client 51 */ 52static inline void 53ipc_client_connection_unlock(struct ipc_connection *ipc_c) 54{ 55 os_mutex_unlock(&ipc_c->mutex); 56} 57 58/*! 59 * Tear down the basics of the client connection: socket and shared mem 60 * @param ipc_c initialized IPC connection struct 61 * 62 * @ingroup ipc_client 63 */ 64void 65ipc_client_connection_fini(struct ipc_connection *ipc_c);