From 5e6c9963d8873d0555f95be3fc7c9e4be161a2ff Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 Sep 2014 04:19:41 +0200 Subject: input: explain why we use semaphores Also switch function names for better self-documentation. --- input/input.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/input/input.c b/input/input.c index 6a3a174bcd..6984676dfb 100644 --- a/input/input.c +++ b/input/input.c @@ -854,14 +854,17 @@ void mp_input_wait(struct input_ctx *ictx, double seconds) } } -void mp_input_wakeup(struct input_ctx *ictx) +void mp_input_wakeup_nolock(struct input_ctx *ictx) { + // Some audio APIs discourage use of locking in their audio callback, + // and these audio callbacks happen to call mp_input_wakeup_nolock() + // when new data is needed. This is why we use semaphores here. sem_post(&ictx->wakeup); } -void mp_input_wakeup_nolock(struct input_ctx *ictx) +void mp_input_wakeup(struct input_ctx *ictx) { - mp_input_wakeup(ictx); + mp_input_wakeup_nolock(ictx); } mp_cmd_t *mp_input_read_cmd(struct input_ctx *ictx) -- cgit v1.2.3