summaryrefslogtreecommitdiff
path: root/threading_pthread.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-10-24 09:37:43 +0200
committerGravatar waker <wakeroid@gmail.com>2010-11-14 22:33:43 +0100
commit5a6ebf3ea5d325fbdf6cc33333274ca37fee5a2e (patch)
treeaff21d2096bd2116184b849b59cc6d603cda0cec /threading_pthread.c
parent2c2b62a0f140221dec44d31d6d04816f3cea4f3f (diff)
added thread_detach and thread_exit APIs
Diffstat (limited to 'threading_pthread.c')
-rw-r--r--threading_pthread.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/threading_pthread.c b/threading_pthread.c
index 66db5844..13d12b94 100644
--- a/threading_pthread.c
+++ b/threading_pthread.c
@@ -99,6 +99,21 @@ thread_join (intptr_t tid) {
return 0;
}
+int
+thread_detach (intptr_t tid) {
+ int s = pthread_detach ((pthread_t)tid);
+ if (s) {
+ fprintf (stderr, "pthread_detach failed: %s\n", strerror (s));
+ return -1;
+ }
+ return 0;
+}
+
+void
+thread_exit (void *retval) {
+ pthread_exit (retval);
+}
+
uintptr_t
mutex_create_nonrecursive (void) {
pthread_mutex_t *mtx = malloc (sizeof (pthread_mutex_t));