Make more improvements to threading support

- fix rare thread exit race condition on openbsd
- pthread_getattr_np() now supplies detached status
- child threads may now pthread_join() the main thread
- introduce sigandset(), sigorset(), and sigisemptyset()
- introduce pthread_cleanup_push() and pthread_cleanup_pop()
This commit is contained in:
Justine Tunney 2022-10-08 23:54:05 -07:00
parent 38df0a4186
commit 4a6fd3d910
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
52 changed files with 586 additions and 241 deletions

View file

@ -2,6 +2,7 @@
#define COSMOPOLITAN_LIBC_ASSERT_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#include "libc/intrin/kprintf.h"
extern bool __assert_disable;
void __assert_fail(const char *, const char *, int) hidden relegated;
@ -23,11 +24,12 @@ void __assert_fail(const char *, const char *, int) hidden relegated;
} \
} while (0)
#define _npassert(x) \
do { \
if (__builtin_expect(!(x), 0)) { \
notpossible; \
} \
#define _npassert(x) \
do { \
if (__builtin_expect(!(x), 0)) { \
kprintf("%s:%d: oh no!\n", __FILE__, __LINE__); \
notpossible; \
} \
} while (0)
COSMOPOLITAN_C_END_