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
+9
View File
@@ -94,6 +94,11 @@ when size_of(int) == 8 {
SEM_T_SIZE :: 16
}
PTHREAD_CANCEL_ENABLE :: 0
PTHREAD_CANCEL_DISABLE :: 1
PTHREAD_CANCEL_DEFERRED :: 0
PTHREAD_CANCEL_ASYNCHRONOUS :: 1
foreign import "system:pthread"
@(default_calling_convention="c")
@@ -112,4 +117,8 @@ foreign pthread {
// NOTE: unclear whether pthread_yield is well-supported on Linux systems,
// see https://linux.die.net/man/3/pthread_yield
pthread_yield :: proc() -> c.int ---
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 ---
}