summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-20 04:19:41 +0200
committerwm4 <wm4@nowhere>2014-09-20 04:22:37 +0200
commit5e6c9963d8873d0555f95be3fc7c9e4be161a2ff (patch)
treedd7f81131a75090964edd6b15a4b551ba3c47252
parent34fac3bf68f4787508648b6236d3d18059ba8775 (diff)
downloadmpv-5e6c9963d8873d0555f95be3fc7c9e4be161a2ff.tar.bz2
mpv-5e6c9963d8873d0555f95be3fc7c9e4be161a2ff.tar.xz
input: explain why we use semaphores
Also switch function names for better self-documentation.
-rw-r--r--input/input.c9
1 files 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)