From ef827af06cbf334a497fb0de8c9b75188549d03e Mon Sep 17 00:00:00 2001
From: wm4 <wm4@nowhere>
Date: Mon, 2 Feb 2015 17:24:33 +0100
Subject: client API: add mpv_wait_async_requests()

This does what it's documented to do.

The implementation reuses the code in mpv_detach_destroy(). Due to the
way async requests currently work, just sending a synchronous dummy
request (like a "ignore" command) would be enough to ensure
synchronization, but this code will continue to work even if this
changes.

The line "ctx->event_mask = 0;" is removed, but it shouldn't be needed.
(If a client is somehow very slow to terminate, this could silence an
annoying queue overflow message, but all in all it does nothing.)

Calling mpv_wait_async_requests() and mpv_wait_event() concurrently is
in theory allowed, so change pthread_cond_signal() to
pthread_cond_broadcast() to avoid missed wakeups.

As requested in issue #1542.
---
 libmpv/mpv.def | 1 +
 1 file changed, 1 insertion(+)

(limited to 'libmpv/mpv.def')

diff --git a/libmpv/mpv.def b/libmpv/mpv.def
index 5176beaa8a..d4d45874fa 100644
--- a/libmpv/mpv.def
+++ b/libmpv/mpv.def
@@ -38,5 +38,6 @@ mpv_set_wakeup_callback
 mpv_suspend
 mpv_terminate_destroy
 mpv_unobserve_property
+mpv_wait_async_requests
 mpv_wait_event
 mpv_wakeup
\ No newline at end of file
-- 
cgit v1.2.3

