mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -519,7 +519,7 @@ void screenshot_flip(struct MPContext *mpctx)
|
||||
|
||||
struct mp_waiter wait = MP_WAITER_INITIALIZER;
|
||||
void *a[] = {mpctx, &wait};
|
||||
run_command(mpctx, mp_cmd_clone(ctx->each_frame), screenshot_fin, a);
|
||||
run_command(mpctx, mp_cmd_clone(ctx->each_frame), NULL, screenshot_fin, a);
|
||||
|
||||
// Block (in a reentrant way) until he screenshot was written. Otherwise,
|
||||
// we could pile up screenshot requests forever.
|
||||
|
||||
Reference in New Issue
Block a user