Monado OpenXR Runtime
Loading...
Searching...
No Matches
ipc_server_thread_shutdown.c File Reference

IPC client thread shutdown and blocking I/O cancellation. More...

Include dependency graph for ipc_server_thread_shutdown.c:

Functions

void ipc_server_client_thread_set_running (struct ipc_server *s, struct ipc_thread *it)
 Do not revive a starting thread that shutdown has already stopped.
 
bool ipc_server_client_thread_is_running (struct ipc_server *s, struct ipc_thread *it)
 Read the loop state under the same lock used to stop or start it.
 
void ipc_server_stop_and_join_client_threads (struct ipc_server *s)
 Stop and join any remaining per-client threads.
 

Detailed Description

IPC client thread shutdown and blocking I/O cancellation.

Author
Jonathan Steffan jstef.nosp@m.fan@.nosp@m.fedor.nosp@m.apro.nosp@m.ject..nosp@m.org
Nick Kennedy code@.nosp@m.nick.nosp@m.-kenn.nosp@m.edy..nosp@m.com

Function Documentation

◆ ipc_server_client_thread_is_running()

bool ipc_server_client_thread_is_running ( struct ipc_server *  s,
struct ipc_thread *  it 
)

Read the loop state under the same lock used to stop or start it.

◆ ipc_server_client_thread_set_running()

void ipc_server_client_thread_set_running ( struct ipc_server *  s,
struct ipc_thread *  it 
)

Do not revive a starting thread that shutdown has already stopped.

◆ ipc_server_stop_and_join_client_threads()

void ipc_server_stop_and_join_client_threads ( struct ipc_server *  s)

Stop and join any remaining per-client threads.

Stop all client loops, wake blocking I/O, then join each thread once.

Client threads may still be inside common_shutdown(), which destroys each client's compositor and dereferences s->xsysd / s->xso. Joining them before teardown_all() destroys those resources avoids a race where a client thread locks a mutex that teardown has already freed (observed as an om->initialized assertion in multi_compositor_destroy).

Stop their loops before joining: the epoll based client loop notices STOPPING on its next timeout, while the Windows one is woken by ipc_server_cancel_all_client_io.

Called from shutdown_clients() before the main loop returns, and again from teardown_all() as a fallback.