mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Make improvements to locking
This change makes pthread_mutex_lock() as fast as _spinlock() by default. Thread instability issues on NetBSD have been resolved. Improvements made to gdtoa thread code. Crash reporting will now synchronize between threads in a slightly better way.
This commit is contained in:
parent
25041b8026
commit
d5312b60f7
60 changed files with 890 additions and 629 deletions
|
@ -30,7 +30,7 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
#define THREADS 16
|
||||
#define THREADS 32
|
||||
|
||||
#define DUB(i) (union Dub){i}.x
|
||||
|
||||
|
@ -61,10 +61,6 @@ int Worker(void *p) {
|
|||
}
|
||||
|
||||
TEST(dtoa, test) {
|
||||
if (IsNetbsd()) {
|
||||
// TODO(jart): Why does this flake on NetBSD?!
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < THREADS; ++i) {
|
||||
clone(Worker,
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
@ -63,11 +64,15 @@ TEST(fgetc, testUnbuffered) {
|
|||
}
|
||||
|
||||
BENCH(fputc, bench) {
|
||||
__enable_tls();
|
||||
__enable_threads();
|
||||
FILE *f;
|
||||
ASSERT_NE(NULL, (f = fopen("/dev/null", "w")));
|
||||
EZBENCH2("fputc", donothing, fputc('E', f));
|
||||
flockfile(f);
|
||||
flockfile(f);
|
||||
EZBENCH2("fputc_unlocked", donothing, fputc_unlocked('E', f));
|
||||
funlockfile(f);
|
||||
funlockfile(f);
|
||||
fclose(f);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue