Add more POSIX threads APIs

This commit is contained in:
Justine Tunney 2022-09-09 11:30:33 -07:00
parent 1729a8259c
commit c3208eb9d5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
32 changed files with 592 additions and 87 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/sched-sysv.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
@ -37,6 +38,7 @@
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/errfuns.h"
#include "libc/thread/internal.h"
#include "libc/thread/posixthread.internal.h"
#include "libc/thread/spawn.h"
@ -62,6 +64,9 @@ void _pthread_free(struct PosixThread *pt) {
static int PosixThread(void *arg, int tid) {
struct PosixThread *pt = arg;
enum PosixThreadStatus status;
if (pt->attr.inheritsched == PTHREAD_EXPLICIT_SCHED) {
_pthread_reschedule(pt);
}
if (!setjmp(pt->exiter)) {
((cthread_t)__get_tls())->pthread = (pthread_t)pt;
pt->rc = pt->start_routine(pt->arg);