diff options
author | wm4 <wm4@nowhere> | 2016-09-04 17:00:21 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-04 18:05:36 +0200 |
commit | 3878a59e2c2ecca25ea9c94d0082ed2df3d52796 (patch) | |
tree | 95c2feeac5e96aba5c25f3718a6dc2a8e5088487 /README.md | |
parent | 2619d8eff4e2c1cf54574acfbd0cd5895e362e45 (diff) | |
download | mpv-3878a59e2c2ecca25ea9c94d0082ed2df3d52796.tar.bz2 mpv-3878a59e2c2ecca25ea9c94d0082ed2df3d52796.tar.xz |
dispatch: redo locking, and allow reentrant processing
A deadlock bug was reported with the following test program:
mpv_handle *mpv = mpv_create();
mpv_set_option_string(mpv, "ytdl", "yes");
mpv_initialize(mpv);
mpv_terminate_destroy(mpv);
The cause of this is loading the ytdl.lua script, which triggers a
certain code path that calls mp_dispatch_queue_process() recursively. It
does so to wait until the script is loaded, and we want to keep that.
Reentrancy was not supported by mp_dispatch, which leads to the
deadlock. Rewrite the locking so that it does. We mainly get rid of the
"exclusive_lock" mutex. Instead we use the existing lock/condition
variable to wait until we can grab a logical lock.
Note that the lock_frame business can be replaced with a simple counter.
Instead of checking the lock_frame address, it'd simply increment and
store the counter when entering mp_dispatch_queue_process(), and then
compare the counter to decide whether or not to wait. But I think the
additional error checking done by the lock_frame list is valuable.
Fixes #3489.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions