Make getentropy() faster

This commit is contained in:
Justine Tunney 2024-10-10 18:24:23 -07:00
parent 17a85e4790
commit 000d6dbb0f
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 19 additions and 19 deletions

View file

@ -33,8 +33,6 @@
#include "libc/testlib/testlib.h"
#include "libc/thread/thread.h"
#ifndef __aarch64__
// TODO(jart): Make this test less resource intensive.
// TODO(jart): Why can EINTR happen on Windows?
atomic_int done;
atomic_int ready;
@ -51,11 +49,9 @@ void *TortureWorker(void *arg) {
ASSERT_SYS(0, 0, sigprocmask(SIG_SETMASK, &ss, 0));
ready = true;
while (!done) {
if (!IsWindows())
pthread_kill(parent, SIGUSR1);
pthread_kill(parent, SIGUSR1);
usleep(1);
if (!IsWindows())
pthread_kill(parent, SIGUSR2);
pthread_kill(parent, SIGUSR2);
usleep(1);
}
return 0;
@ -100,8 +96,7 @@ TEST(getentropy, test) {
}
done = true;
ASSERT_EQ(0, pthread_join(child, 0));
if (!IsWindows())
ASSERT_GT(gotsome, 0);
ASSERT_GT(gotsome, 0);
}
#endif /* __aarch64__ */