mirror of
https://github.com/mpv-player/mpv
synced 2025-03-07 06:37:46 +00:00
input: explain why we use semaphores
Also switch function names for better self-documentation.
This commit is contained in:
parent
34fac3bf68
commit
5e6c9963d8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user