From 7428cc51496ca8e56600fdc4034b8f55720f09f9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 13 May 2018 13:48:47 +0200 Subject: client API: kill async commands on termination This affects async commands started by client API, commands with async capability run in a sync way by client API (think mpv_command_node() with "subprocess"), and detached async work. Since scripts might want to do some cleanup work (that might involve launching processes, don't ask), we don't unconditionally kill everything on exit, but apply an arbitrary timeout of 2 seconds until async commands are aborted. --- player/loadfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 6f28d2ee38..c4e013793d 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -113,8 +113,11 @@ void mp_abort_remove(struct MPContext *mpctx, struct mp_abort_entry *abort) void mp_abort_recheck_locked(struct MPContext *mpctx, struct mp_abort_entry *abort) { - if (abort->coupled_to_playback && mp_cancel_test(mpctx->playback_abort)) + if ((abort->coupled_to_playback && mp_cancel_test(mpctx->playback_abort)) || + mpctx->abort_all) + { mp_abort_trigger_locked(mpctx, abort); + } } void mp_abort_trigger_locked(struct MPContext *mpctx, -- cgit v1.2.3