mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Implement POSIX threads API
This commit is contained in:
parent
af24f21556
commit
9be364d40a
95 changed files with 6029 additions and 317 deletions
31
libc/thread/posixthread.internal.h
Normal file
31
libc/thread/posixthread.internal.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#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_
|
||||
|
||||
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_ */
|
Loading…
Add table
Add a link
Reference in a new issue