1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00:00
mpv/misc
wm4 3878a59e2c 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.
2016-09-04 18:05:36 +02:00
..
bstr.c vo_opengl: use RPN expressions for user hook sizes 2016-05-15 20:42:02 +02:00
bstr.h Fix misspellings 2016-06-26 13:47:21 +02:00
charset_conv.c charset_conv: Use CP949 instead of EUC-KR 2016-09-02 14:46:11 +02:00
charset_conv.h sub: detect charset in demuxer 2015-12-17 01:17:23 +01:00
ctype.h Audit and replace all ctype.h uses 2014-07-01 23:11:08 +02:00
dispatch.c dispatch: redo locking, and allow reentrant processing 2016-09-04 18:05:36 +02:00
dispatch.h client API: implement mpv_suspend/resume slightly differently 2016-09-04 18:05:36 +02:00
json.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
json.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
node.c misc: add some annoying mpv_node helpers 2016-08-28 19:39:05 +02:00
node.h misc: add some annoying mpv_node helpers 2016-08-28 19:39:05 +02:00
rendezvous.c Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
rendezvous.h Add Plan 9-style barriers 2014-07-26 20:29:48 +02:00
ring.c Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
ring.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00