mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-01 18:22:27 +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
|
@ -35,14 +35,14 @@ void *worker(void *arg) {
|
|||
}
|
||||
|
||||
void test(int n) {
|
||||
struct timespec start = timespec_real();
|
||||
struct timespec start = timespec_mono();
|
||||
pthread_t *th = malloc(sizeof(pthread_t) * n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pthread_create(th + i, 0, worker, 0);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pthread_join(th[i], 0);
|
||||
free(th);
|
||||
struct timespec end = timespec_real();
|
||||
struct timespec end = timespec_mono();
|
||||
printf("%2d threads * %d allocs = %ld us\n", n, ALLOCATIONS,
|
||||
timespec_tomicros(timespec_sub(end, start)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue