The open source OpenXR runtime

ipc: Add exit_to_disconnect as property of ipc_server_main_info struct

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2612>

authored by

Rafal Karp and committed by
Jakob Bornecrantz
857d7f0e 34acfc91

+10 -4
+3
src/xrt/ipc/server/ipc_server_interface.h
··· 36 { 37 //! Information passed onto the debug gui. 38 struct u_debug_gui_create_info udgci; 39 }; 40 41 /*!
··· 36 { 37 //! Information passed onto the debug gui. 38 struct u_debug_gui_create_info udgci; 39 + 40 + //! Flag whether runtime should exit on app disconnect. 41 + bool exit_on_disconnect; 42 }; 43 44 /*!
+3 -4
src/xrt/ipc/server/ipc_server_process.c
··· 57 * 58 */ 59 60 - DEBUG_GET_ONCE_BOOL_OPTION(exit_on_disconnect, "IPC_EXIT_ON_DISCONNECT", false) 61 DEBUG_GET_ONCE_BOOL_OPTION(exit_when_idle, "IPC_EXIT_WHEN_IDLE", false) 62 DEBUG_GET_ONCE_NUM_OPTION(exit_when_idle_delay_ms, "IPC_EXIT_WHEN_IDLE_DELAY_MS", 5000) 63 DEBUG_GET_ONCE_LOG_OPTION(ipc_log, "IPC_LOG", U_LOGGING_INFO) ··· 455 } 456 457 static xrt_result_t 458 - init_all(struct ipc_server *s, enum u_logging_level log_level) 459 { 460 xrt_result_t xret = XRT_SUCCESS; 461 int ret; ··· 480 481 // Yes we should be running. 482 s->running = true; 483 - s->exit_on_disconnect = debug_get_bool_option_exit_on_disconnect(); 484 s->exit_when_idle = debug_get_bool_option_exit_when_idle(); 485 s->last_client_disconnect_ns = 0; 486 uint64_t delay_ms = debug_get_num_option_exit_when_idle_delay_ms(); ··· 1033 */ 1034 u_debug_gui_create(&ismi->udgci, &s->debug_gui); 1035 1036 - xret = init_all(s, log_level); 1037 U_LOG_CHK_ONLY_PRINT(log_level, xret, "init_all"); 1038 if (xret != XRT_SUCCESS) { 1039 // Propegate the failure.
··· 57 * 58 */ 59 60 DEBUG_GET_ONCE_BOOL_OPTION(exit_when_idle, "IPC_EXIT_WHEN_IDLE", false) 61 DEBUG_GET_ONCE_NUM_OPTION(exit_when_idle_delay_ms, "IPC_EXIT_WHEN_IDLE_DELAY_MS", 5000) 62 DEBUG_GET_ONCE_LOG_OPTION(ipc_log, "IPC_LOG", U_LOGGING_INFO) ··· 454 } 455 456 static xrt_result_t 457 + init_all(struct ipc_server *s, enum u_logging_level log_level, bool exit_on_disconnect) 458 { 459 xrt_result_t xret = XRT_SUCCESS; 460 int ret; ··· 479 480 // Yes we should be running. 481 s->running = true; 482 + s->exit_on_disconnect = exit_on_disconnect; 483 s->exit_when_idle = debug_get_bool_option_exit_when_idle(); 484 s->last_client_disconnect_ns = 0; 485 uint64_t delay_ms = debug_get_num_option_exit_when_idle_delay_ms(); ··· 1032 */ 1033 u_debug_gui_create(&ismi->udgci, &s->debug_gui); 1034 1035 + xret = init_all(s, log_level, ismi->exit_on_disconnect); 1036 U_LOG_CHK_ONLY_PRINT(log_level, xret, "init_all"); 1037 if (xret != XRT_SUCCESS) { 1038 // Propegate the failure.
+4
src/xrt/targets/service/main.c
··· 11 12 #include "xrt/xrt_config_os.h" 13 14 #include "util/u_metrics.h" 15 #include "util/u_logging.h" 16 #include "util/u_trace_marker.h" ··· 22 #include "server/ipc_server_interface.h" 23 24 #include "target_lists.h" 25 26 27 // Insert the on load constructor to init trace marker. ··· 44 .window_title = "Monado! ✨⚡🔥", 45 .open = U_DEBUG_GUI_OPEN_AUTO, 46 }, 47 }; 48 49 int ret = ipc_server_main(argc, argv, &ismi);
··· 11 12 #include "xrt/xrt_config_os.h" 13 14 + #include "util/u_debug.h" 15 #include "util/u_metrics.h" 16 #include "util/u_logging.h" 17 #include "util/u_trace_marker.h" ··· 23 #include "server/ipc_server_interface.h" 24 25 #include "target_lists.h" 26 + 27 + DEBUG_GET_ONCE_BOOL_OPTION(exit_on_disconnect, "IPC_EXIT_ON_DISCONNECT", false) 28 29 30 // Insert the on load constructor to init trace marker. ··· 47 .window_title = "Monado! ✨⚡🔥", 48 .open = U_DEBUG_GUI_OPEN_AUTO, 49 }, 50 + .exit_on_disconnect = debug_get_bool_option_exit_on_disconnect(), 51 }; 52 53 int ret = ipc_server_main(argc, argv, &ismi);