diff options
author | wm4 <wm4@nowhere> | 2018-05-12 18:46:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:34 +0200 |
commit | e4fb23ed7de874bb2d05824d7edb84cfd1b21101 (patch) | |
tree | ff56d6949cdead5795607c86882ce44aca0b7da7 /input/cmd.h | |
parent | ce1f5e78c2b10e24c78d7ee65d7196093709b8ce (diff) | |
download | mpv-e4fb23ed7de874bb2d05824d7edb84cfd1b21101.tar.bz2 mpv-e4fb23ed7de874bb2d05824d7edb84cfd1b21101.tar.xz |
command: add a way to abort asynchronous commands
Many asynchronous commands are potentially long running operations, such
as loading something from network or running a foreign process.
Obviously it shouldn't just be possible for them to freeze the player if
they don't terminate as expected. Also, there will be situations where
you want to explicitly stop some of those operations explicitly. So add
an infrastructure for this.
Commands have to support this explicitly. The next commit uses this to
actually add support to a command.
Diffstat (limited to 'input/cmd.h')
-rw-r--r-- | input/cmd.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/input/cmd.h b/input/cmd.h index 0e65565252..f6408988ab 100644 --- a/input/cmd.h +++ b/input/cmd.h @@ -54,6 +54,10 @@ struct mp_cmd_def { // unlocked, you have no synchronized access to mpctx, but you can do long // running operations without blocking playback or input handling). bool spawn_thread; + // If this is set, mp_cmd_ctx.abort is set. Set this if handler() can do + // asynchronous abort of the command, and explicitly uses mp_cmd_ctx.abort. + // (Not setting it when it's not needed can save resources.) + bool can_abort; }; enum mp_cmd_flags { |