mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-01 06:28:21 +00:00
It now works most excellently across all supported operating sytsems (earlier it didn't work on NT and XNU). Demo code is available in examples/clock.c and this change also adds some of the newer ANSI C time functions like timespec_get(), plus timespec_getres() which hasn't even come out yet as it's C23
35 lines
854 B
C
35 lines
854 B
C
#ifndef COSMOPOLITAN_LIBC_THREAD_POSIXTHREAD_INTERNAL_H_
|
|
#define COSMOPOLITAN_LIBC_THREAD_POSIXTHREAD_INTERNAL_H_
|
|
#include "libc/runtime/runtime.h"
|
|
#include "libc/thread/spawn.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
/**
|
|
* @fileoverview Cosmopolitan POSIX Thread Internals
|
|
*/
|
|
|
|
enum PosixThreadStatus {
|
|
kPosixThreadStarted,
|
|
kPosixThreadDetached,
|
|
kPosixThreadTerminated,
|
|
kPosixThreadZombie,
|
|
};
|
|
|
|
struct PosixThread {
|
|
struct spawn spawn;
|
|
void *(*start_routine)(void *);
|
|
void *arg;
|
|
void *rc;
|
|
int tid;
|
|
_Atomic(enum PosixThreadStatus) status;
|
|
jmp_buf exiter;
|
|
};
|
|
|
|
void pthread_zombies_add(struct PosixThread *);
|
|
void pthread_zombies_decimate(void);
|
|
void pthread_zombies_harvest(void);
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_THREAD_POSIXTHREAD_INTERNAL_H_ */
|