diff options
Diffstat (limited to 'input')
-rw-r--r-- | input/input.c | 13 | ||||
-rw-r--r-- | input/input.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/input/input.c b/input/input.c index 3ab6089de3..2671256270 100644 --- a/input/input.c +++ b/input/input.c @@ -119,6 +119,8 @@ struct cmd_queue { struct input_ctx { pthread_mutex_t mutex; pthread_cond_t wakeup; + pthread_t mainthread; + bool mainthread_set; struct mp_log *log; struct mpv_global *global; @@ -1640,13 +1642,20 @@ static bool test_abort(struct input_ctx *ictx) return false; } +void mp_input_set_main_thread(struct input_ctx *ictx) +{ + ictx->mainthread = pthread_self(); + ictx->mainthread_set = true; +} + bool mp_input_check_interrupt(struct input_ctx *ictx) { input_lock(ictx); bool res = test_abort(ictx); - if (!res) { + if (!res && ictx->mainthread_set && + pthread_equal(ictx->mainthread, pthread_self()) == 0) + { read_events(ictx, 0); - res = test_abort(ictx); } input_unlock(ictx); return res; diff --git a/input/input.h b/input/input.h index 8f46b0fd9a..b774462aab 100644 --- a/input/input.h +++ b/input/input.h @@ -219,6 +219,8 @@ bool mp_input_use_alt_gr(struct input_ctx *ictx); void mp_input_run_cmd(struct input_ctx *ictx, int def_flags, const char **cmd, const char *location); +void mp_input_set_main_thread(struct input_ctx *ictx); + extern int async_quit_request; #endif /* MPLAYER_INPUT_H */ |