diff options
author | wm4 <wm4@nowhere> | 2018-05-12 16:51:53 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:34 +0200 |
commit | ce1f5e78c2b10e24c78d7ee65d7196093709b8ce (patch) | |
tree | 101b19e7372368e4f900234262a55d71380835c2 /player | |
parent | 7f91e2684e8600c45512e36f03aadff0b825a1b0 (diff) | |
download | mpv-ce1f5e78c2b10e24c78d7ee65d7196093709b8ce.tar.bz2 mpv-ce1f5e78c2b10e24c78d7ee65d7196093709b8ce.tar.xz |
player: rename "lock" to "abort_lock"
If a struct as large as MPContext contains a field named "lock", it
creates the impression that it is the primary lock for MPContext. This
is wrong, the lock just protects a single field.
Diffstat (limited to 'player')
-rw-r--r-- | player/core.h | 4 | ||||
-rw-r--r-- | player/loadfile.c | 16 | ||||
-rw-r--r-- | player/main.c | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/player/core.h b/player/core.h index 9a9eb81852..0434c5cb64 100644 --- a/player/core.h +++ b/player/core.h @@ -438,9 +438,9 @@ typedef struct MPContext { struct mp_ipc_ctx *ipc_ctx; - pthread_mutex_t lock; + pthread_mutex_t abort_lock; - // --- The following fields are protected by lock + // --- The following fields are protected by abort_lock struct mp_cancel *demuxer_cancel; // cancel handle for MPContext.demuxer // --- Owned by MPContext diff --git a/player/loadfile.c b/player/loadfile.c index 766f86a77b..e1864f3fd5 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -66,10 +66,10 @@ void mp_abort_playback_async(struct MPContext *mpctx) { mp_cancel_trigger(mpctx->playback_abort); - pthread_mutex_lock(&mpctx->lock); + pthread_mutex_lock(&mpctx->abort_lock); if (mpctx->demuxer_cancel) mp_cancel_trigger(mpctx->demuxer_cancel); - pthread_mutex_unlock(&mpctx->lock); + pthread_mutex_unlock(&mpctx->abort_lock); } static void uninit_demuxer(struct MPContext *mpctx) @@ -96,10 +96,10 @@ static void uninit_demuxer(struct MPContext *mpctx) free_demuxer_and_stream(mpctx->demuxer); mpctx->demuxer = NULL; - pthread_mutex_lock(&mpctx->lock); + pthread_mutex_lock(&mpctx->abort_lock); talloc_free(mpctx->demuxer_cancel); mpctx->demuxer_cancel = NULL; - pthread_mutex_unlock(&mpctx->lock); + pthread_mutex_unlock(&mpctx->abort_lock); } #define APPEND(s, ...) mp_snprintf_cat(s, sizeof(s), __VA_ARGS__) @@ -936,9 +936,9 @@ static void open_demux_reentrant(struct MPContext *mpctx) start_open(mpctx, url, mpctx->playing->stream_flags); // User abort should cancel the opener now. - pthread_mutex_lock(&mpctx->lock); + pthread_mutex_lock(&mpctx->abort_lock); mpctx->demuxer_cancel = mpctx->open_cancel; - pthread_mutex_unlock(&mpctx->lock); + pthread_mutex_unlock(&mpctx->abort_lock); while (!atomic_load(&mpctx->open_done)) { mp_idle(mpctx); @@ -954,9 +954,9 @@ static void open_demux_reentrant(struct MPContext *mpctx) mpctx->open_cancel = NULL; } else { mpctx->error_playing = mpctx->open_res_error; - pthread_mutex_lock(&mpctx->lock); + pthread_mutex_lock(&mpctx->abort_lock); mpctx->demuxer_cancel = NULL; - pthread_mutex_unlock(&mpctx->lock); + pthread_mutex_unlock(&mpctx->abort_lock); } cancel_open(mpctx); // cleanup diff --git a/player/main.c b/player/main.c index bc14bbce1c..d744c9cf12 100644 --- a/player/main.c +++ b/player/main.c @@ -189,7 +189,7 @@ void mp_destroy(struct MPContext *mpctx) uninit_libav(mpctx->global); mp_msg_uninit(mpctx->global); - pthread_mutex_destroy(&mpctx->lock); + pthread_mutex_destroy(&mpctx->abort_lock); talloc_free(mpctx); } @@ -283,7 +283,7 @@ struct MPContext *mp_create(void) .thread_pool = mp_thread_pool_create(mpctx, 0, 1, 30), }; - pthread_mutex_init(&mpctx->lock, NULL); + pthread_mutex_init(&mpctx->abort_lock, NULL); mpctx->global = talloc_zero(mpctx, struct mpv_global); |