summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-06 17:22:53 +0200
committerwm4 <wm4@nowhere>2014-06-06 17:22:53 +0200
commit7716424d48203761412df9a948faa1f1ad575b34 (patch)
tree149da9ae8fbf5a03b296971b6727d3469c8cf87f /player
parent662592c8605db0de92c1ff07402637d9a734e201 (diff)
downloadmpv-7716424d48203761412df9a948faa1f1ad575b34.tar.bz2
mpv-7716424d48203761412df9a948faa1f1ad575b34.tar.xz
client API: use shared code for creating the wakeup pipe
Should be equivalent, reduces code duplication.
Diffstat (limited to 'player')
-rw-r--r--player/client.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/player/client.c b/player/client.c
index e9a583f17b..7edd2e34c1 100644
--- a/player/client.c
+++ b/player/client.c
@@ -1271,18 +1271,8 @@ int mpv_request_log_messages(mpv_handle *ctx, const char *min_level)
int mpv_get_wakeup_pipe(mpv_handle *ctx)
{
pthread_mutex_lock(&ctx->lock);
-#if defined(F_SETFL)
- if (ctx->wakeup_pipe[0] == -1) {
- if (pipe(ctx->wakeup_pipe) != 0)
- goto fail;
- for (int i = 0; i < 2; i++) {
- mp_set_cloexec(ctx->wakeup_pipe[i]);
- int ret = fcntl(ctx->wakeup_pipe[i], F_GETFL);
- fcntl(ctx->wakeup_pipe[i], F_SETFL, ret | O_NONBLOCK);
- }
- }
-fail:
-#endif
+ if (ctx->wakeup_pipe[0] == -1)
+ mp_make_wakeup_pipe(ctx->wakeup_pipe);
pthread_mutex_unlock(&ctx->lock);
return ctx->wakeup_pipe[0];
}