summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-20 20:06:43 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-21 20:49:32 +0900
commit45b63c78cd1b4dc0e78e762711f1e13ff6d97e23 (patch)
treedb77cb5412aefd3916e0e1e91bc47a1863ac77e0
parentde4727371638afb7cfb5d08bf885a1d91029ceae (diff)
downloadmpv-45b63c78cd1b4dc0e78e762711f1e13ff6d97e23.tar.bz2
mpv-45b63c78cd1b4dc0e78e762711f1e13ff6d97e23.tar.xz
player: cosmetics: async/non-blocking -> reentrant
These functions do blocking work on a separate thread, but wait until they return. So they are not async or non-blocking. But they do react to user-input and client API accesses, which makes them reentrant. (cherry picked from commit 2c305d5b2990d31911d7faa4c9117bf4eb89c88b)
-rw-r--r--player/core.h4
-rw-r--r--player/loadfile.c18
-rw-r--r--player/misc.c4
3 files changed, 13 insertions, 13 deletions
diff --git a/player/core.h b/player/core.h
index 98b3c7cd86..6909a2f712 100644
--- a/player/core.h
+++ b/player/core.h
@@ -412,8 +412,8 @@ bool mp_get_cache_idle(struct MPContext *mpctx);
void update_window_title(struct MPContext *mpctx, bool force);
void error_on_track(struct MPContext *mpctx, struct track *track);
void stream_dump(struct MPContext *mpctx);
-int mpctx_run_non_blocking(struct MPContext *mpctx, void (*thread_fn)(void *arg),
- void *thread_arg);
+int mpctx_run_reentrant(struct MPContext *mpctx, void (*thread_fn)(void *arg),
+ void *thread_arg);
struct mpv_global *create_sub_global(struct MPContext *mpctx);
// osd.c
diff --git a/player/loadfile.c b/player/loadfile.c
index a1a4ca00ba..71d04d76d4 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -933,8 +933,8 @@ static void open_stream_thread(void *pctx)
args->cancel, args->global);
}
-static struct stream *open_stream_async(struct MPContext *mpctx,
- char *filename, int stream_flags)
+static struct stream *open_stream_reentrant(struct MPContext *mpctx,
+ char *filename, int stream_flags)
{
struct stream_open_args args = {
.cancel = mpctx->playback_abort,
@@ -942,7 +942,7 @@ static struct stream *open_stream_async(struct MPContext *mpctx,
.filename = filename,
.stream_flags = stream_flags,
};
- mpctx_run_non_blocking(mpctx, open_stream_thread, &args);
+ mpctx_run_reentrant(mpctx, open_stream_thread, &args);
if (args.stream) {
talloc_steal(args.stream, args.global);
} else {
@@ -965,11 +965,11 @@ static void open_demux_thread(void *pctx)
args->demux = demux_open(s, global->opts->demuxer_name, NULL, global);
}
-static struct demuxer *open_demux_async(struct MPContext *mpctx,
- struct stream *stream)
+static struct demuxer *open_demux_reentrant(struct MPContext *mpctx,
+ struct stream *stream)
{
struct demux_open_args args = {stream, create_sub_global(mpctx)};
- mpctx_run_non_blocking(mpctx, open_demux_thread, &args);
+ mpctx_run_reentrant(mpctx, open_demux_thread, &args);
if (args.demux) {
talloc_steal(args.demux, args.global);
} else {
@@ -1080,8 +1080,8 @@ static void play_current_file(struct MPContext *mpctx)
int stream_flags = STREAM_READ;
if (!opts->load_unsafe_playlists)
stream_flags |= mpctx->playing->stream_flags;
- mpctx->stream = open_stream_async(mpctx, mpctx->stream_open_filename,
- stream_flags);
+ mpctx->stream = open_stream_reentrant(mpctx, mpctx->stream_open_filename,
+ stream_flags);
if (!mpctx->stream)
goto terminate_playback;
@@ -1107,7 +1107,7 @@ goto_reopen_demuxer: ;
mp_nav_reset(mpctx);
- mpctx->demuxer = open_demux_async(mpctx, mpctx->stream);
+ mpctx->demuxer = open_demux_reentrant(mpctx, mpctx->stream);
if (!mpctx->demuxer) {
MP_ERR(mpctx, "Failed to recognize file format.\n");
mpctx->error_playing = MPV_ERROR_UNKNOWN_FORMAT;
diff --git a/player/misc.c b/player/misc.c
index 4fbef24d8e..f6696fa046 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -283,8 +283,8 @@ static void *thread_wrapper(void *pctx)
// Run the thread_fn in a new thread. Wait until the thread returns, but while
// waiting, process input and input commands.
-int mpctx_run_non_blocking(struct MPContext *mpctx, void (*thread_fn)(void *arg),
- void *thread_arg)
+int mpctx_run_reentrant(struct MPContext *mpctx, void (*thread_fn)(void *arg),
+ void *thread_arg)
{
struct wrapper_args args = {mpctx, thread_fn, thread_arg};
pthread_mutex_init(&args.mutex, NULL);