From 7716424d48203761412df9a948faa1f1ad575b34 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 6 Jun 2014 17:22:53 +0200 Subject: client API: use shared code for creating the wakeup pipe Should be equivalent, reduces code duplication. --- player/client.c | 14 ++------------ 1 file 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]; } -- cgit v1.2.3