Implement pthread_cancel.

This commit is contained in:
Jeroen van Rijn
2022-05-11 15:52:04 +02:00
parent 56e3b7cb7d
commit 8fb718245a
6 changed files with 79 additions and 4 deletions
+10 -1
View File
@@ -46,6 +46,11 @@ sched_param :: struct {
sem_t :: distinct rawptr
PTHREAD_CANCEL_ENABLE :: 0
PTHREAD_CANCEL_DISABLE :: 1
PTHREAD_CANCEL_DEFERRED :: 0
PTHREAD_CANCEL_ASYNCHRONOUS :: 1
foreign import libc "system:c"
@(default_calling_convention="c")
@@ -62,4 +67,8 @@ foreign libc {
// NOTE: unclear whether pthread_yield is well-supported on Linux systems,
// see https://linux.die.net/man/3/pthread_yield
pthread_yield :: proc() ---
}
pthread_setcancelstate :: proc (state: c.int, old_state: ^c.int) -> c.int ---
pthread_setcanceltype :: proc (type: c.int, old_type: ^c.int) -> c.int ---
pthread_cancel :: proc (thread: pthread_t) -> c.int ---
}