Skip to content

Commit 9ddbfd9

Browse files
committed
Introduce cosmo_futex_wait and cosmo_futex_wake
Cosmopolitan Futexes are now exposed as a public API.
1 parent 729f704 commit 9ddbfd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+884
-915
lines changed

libc/calls/sig.c

Lines changed: 0 additions & 717 deletions
This file was deleted.

libc/cosmo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#ifndef COSMOPOLITAN_LIBC_COSMO_H_
22
#define COSMOPOLITAN_LIBC_COSMO_H_
3+
#include "libc/calls/struct/timespec.h"
34
COSMOPOLITAN_C_START_
45

56
#ifndef __cplusplus
@@ -17,6 +18,9 @@ int __is_mangled(const char *) libcesque;
1718
bool32 IsLinuxModern(void) libcesque;
1819
int LoadZipArgs(int *, char ***) libcesque;
1920
int cosmo_args(const char *, char ***) libcesque;
21+
int cosmo_futex_wake(_COSMO_ATOMIC(int) *, int, char);
22+
int cosmo_futex_wait(_COSMO_ATOMIC(int) *, int, char, int,
23+
const struct timespec *);
2024

2125
COSMOPOLITAN_C_END_
2226
#endif /* COSMOPOLITAN_LIBC_COSMO_H_ */

libc/intrin/BUILD.mk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ LIBC_INTRIN_A_CHECKS = \
3030
LIBC_INTRIN_A_DIRECTDEPS = \
3131
LIBC_NEXGEN32E \
3232
LIBC_NT_KERNEL32 \
33+
LIBC_NT_REALTIME \
34+
LIBC_NT_SYNCHRONIZATION \
3335
LIBC_NT_WS2_32 \
3436
LIBC_SYSV \
35-
LIBC_SYSV_CALLS
37+
LIBC_SYSV_CALLS \
3638

3739
LIBC_INTRIN_A_DEPS := \
3840
$(call uniq,$(foreach x,$(LIBC_INTRIN_A_DIRECTDEPS),$($(x))))
@@ -106,6 +108,16 @@ o//libc/intrin/demangle.o: private \
106108
CFLAGS += \
107109
-mgeneral-regs-only
108110

111+
# ensure that division is optimized
112+
o/$(MODE)/libc/intrin/windowsdurationtotimeval.o \
113+
o/$(MODE)/libc/intrin/windowsdurationtotimespec.o \
114+
o/$(MODE)/libc/intrin/timevaltowindowstime.o \
115+
o/$(MODE)/libc/intrin/timespectowindowstime.o \
116+
o/$(MODE)/libc/intrin/windowstimetotimeval.o \
117+
o/$(MODE)/libc/intrin/windowstimetotimespec.o: private \
118+
CFLAGS += \
119+
-O2
120+
109121
# these assembly files are safe to build on aarch64
110122
o/$(MODE)/libc/intrin/aarch64/%.o: libc/intrin/aarch64/%.S
111123
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)