From 7251417569a6e7ab770a6c841ac3098e44f1fb7e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 1 Nov 2023 18:42:47 +0000 Subject: [PATCH] ipc: Add functions to lock/unlock the client connection --- src/xrt/ipc/client/ipc_client_connection.h | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/xrt/ipc/client/ipc_client_connection.h b/src/xrt/ipc/client/ipc_client_connection.h index 2f690a50a..5dc9c6c59 100644 --- a/src/xrt/ipc/client/ipc_client_connection.h +++ b/src/xrt/ipc/client/ipc_client_connection.h @@ -29,6 +29,31 @@ ipc_client_connection_init(struct ipc_connection *ipc_c, enum u_logging_level log_level, const struct xrt_instance_info *i_info); +/*! + * Locks the connection, allows sending complex messages. + * + * @param ipc_c The IPC connection to lock. + * + * @ingroup ipc_client + */ +static inline void +ipc_client_connection_lock(struct ipc_connection *ipc_c) +{ + os_mutex_lock(&ipc_c->mutex); +} + +/*! + * Unlocks the connection. + * + * @param ipc_c A locked IPC connection to unlock. + * + * @ingroup ipc_client + */ +static inline void +ipc_client_connection_unlock(struct ipc_connection *ipc_c) +{ + os_mutex_unlock(&ipc_c->mutex); +} /*! * Tear down the basics of the client connection: socket and shared mem