From 14c232bdbfbb16f427632d579430fa1a522f7f73 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 21 Sep 2016 15:55:34 +0200 Subject: client API: fix init/destruction race conditions mp_new_client() blatantly accessed some mutex-protected state outside of the mutex. The destruction code is in theory OK, but with changes in the following commits it'll be a bit hard to guarantee that it stays this way. Add a simple flag that makes adding new clients impossible, so that having no clients after shutdown_clients() remains guaranteed. --- player/client.h | 1 + 1 file changed, 1 insertion(+) (limited to 'player/client.h') diff --git a/player/client.h b/player/client.h index e8866225a7..e39d0e676a 100644 --- a/player/client.h +++ b/player/client.h @@ -16,6 +16,7 @@ struct mp_log; #define MAX_CLIENT_NAME 64 void mp_clients_init(struct MPContext *mpctx); +void mp_client_enter_shutdown(struct MPContext *mpctx); void mp_clients_destroy(struct MPContext *mpctx); int mp_clients_num(struct MPContext *mpctx); bool mp_clients_all_initialized(struct MPContext *mpctx); -- cgit v1.2.3