input: explain why we use semaphores

Also switch function names for better self-documentation.
This commit is contained in:
wm4 2014-09-20 04:19:41 +02:00
parent 34fac3bf68
commit 5e6c9963d8
1 changed files with 6 additions and 3 deletions

View File

@ -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)