LibC: Implement pthread cancelation

This code is not tested at all but it looks correct xD
This commit is contained in:
2025-06-01 00:59:22 +03:00
parent 56fdf6002c
commit dbdefa0f4a
15 changed files with 165 additions and 16 deletions

View File

@@ -32,10 +32,13 @@ struct uthread
struct _pthread_cleanup_t* cleanup_stack;
pthread_t id;
int errno_;
int cancel_type;
int cancel_state;
int canceled;
uintptr_t dtv[];
};
#define PTHREAD_CANCELED 1
#define PTHREAD_CANCELED (void*)1
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
#define PTHREAD_CANCEL_DEFERRED 0
@@ -43,6 +46,9 @@ struct uthread
#define PTHREAD_CANCEL_DISABLE 0
#define PTHREAD_CANCEL_ENABLE 1
// cancellation points
// https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_09_05_02
#define PTHREAD_PRIO_INHERIT 1
#define PTHREAD_PRIO_NONE 0
#define PTHREAD_PRIO_PROTECT 2

View File

@@ -106,7 +106,8 @@ struct sigevent
#define SIGXCPU 27
#define SIGXFSZ 28
#define SIGWINCH 29
#define SIGRTMIN 30
#define SIGCANCEL 30
#define SIGRTMIN 31
#define SIGRTMAX (SIGRTMIN+32)
#define NSIG SIGRTMAX