Make improvements

- Improve compatibility with Blink virtual machine
- Add non-POSIX APIs for joining threads and signal masks
- Never ever use anything except 32-bit integers for atomics
- Add some `#undef` statements to workaround `ctags` problems
This commit is contained in:
Justine Tunney 2022-11-10 21:52:47 -08:00
parent b46ac13504
commit f2af97711b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
114 changed files with 902 additions and 363 deletions

View file

@ -2,21 +2,26 @@
#define COSMOPOLITAN_LIBC_INTRIN_PTHREAD2_H_
#include "libc/calls/struct/cpuset.h"
#include "libc/calls/struct/sched_param.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/timespec.h"
#include "libc/runtime/stack.h"
#include "libc/thread/thread.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* clang-format off */
int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *);
int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *);
int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,
const struct timespec *);
int pthread_setaffinity_np(pthread_t, size_t, const cpu_set_t *);
int pthread_getaffinity_np(pthread_t, size_t, cpu_set_t *);
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
int pthread_getschedparam(pthread_t, int *, struct sched_param *);
int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *) paramsnonnull();
int pthread_attr_getsigmask_np(const pthread_attr_t *, sigset_t *) paramsnonnull((1));
int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *) paramsnonnull();
int pthread_attr_setsigmask_np(pthread_attr_t *, const sigset_t *) paramsnonnull((1));
int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *) paramsnonnull((1, 2));
int pthread_getaffinity_np(pthread_t, size_t, cpu_set_t *) paramsnonnull();
int pthread_getschedparam(pthread_t, int *, struct sched_param *) paramsnonnull();
int pthread_setaffinity_np(pthread_t, size_t, const cpu_set_t *) paramsnonnull();
int pthread_setschedparam(pthread_t, int, const struct sched_param *) paramsnonnull();
int pthread_timedjoin_np(pthread_t, void **, struct timespec *);
/* clang-format off */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_INTRIN_PTHREAD2_H_ */