mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-25 12:00:31 +00:00
Remove callback from cosmoaudio API
Using callbacks is still problematic with cosmo_dlopen() due to the need to restore the TLS register. So using callbacks is even more strict than using signal handlers. We are better off introducing a cosmoaudio_poll() function. It makes the API more UNIX-like. How bad could the latency be?
This commit is contained in:
parent
d99f066114
commit
d50d954a3c
17 changed files with 433 additions and 158 deletions
|
@ -335,10 +335,11 @@ static long Index(long y, long x) {
|
|||
static void PreventBufferbloat(void) {
|
||||
struct timespec now, rate;
|
||||
static struct timespec last;
|
||||
now = timespec_real();
|
||||
now = timespec_mono();
|
||||
rate = timespec_frommicros(1. / fps * 1e6);
|
||||
if (timespec_cmp(timespec_sub(now, last), rate) < 0) {
|
||||
timespec_sleep(CLOCK_REALTIME, timespec_sub(rate, timespec_sub(now, last)));
|
||||
timespec_sleep(CLOCK_MONOTONIC,
|
||||
timespec_sub(rate, timespec_sub(now, last)));
|
||||
}
|
||||
last = now;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue