pthread_threading.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 RenĂ© Kijewski <rene.kijewski@fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef PTHREAD_THREADING_H
18 #define PTHREAD_THREADING_H
19 
20 #include "kernel_defines.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30 typedef unsigned pthread_t;
31 
48 int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
49 
58 void pthread_exit(void *retval) NORETURN;
59 
71 int pthread_join(pthread_t th, void **thread_return);
72 
87 
96 
101 static inline int pthread_equal(pthread_t thread1, pthread_t thread2)
102 {
103  return thread1 == thread2;
104 }
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* PTHREAD_THREADING_H */
111 
pthread_join
int pthread_join(pthread_t th, void **thread_return)
Join a pthread.
kernel_defines.h
Common macros and compiler attributes/pragmas configuration.
pthread_t
unsigned pthread_t
Datatype to identify a POSIX thread.
Definition: pthread_threading.h:30
pthread_attr_t
An attribute set to supply to pthread_create()
Definition: pthread_threading_attr.h:29
pthread_self
pthread_t pthread_self(void)
Returns the pthread id of the calling/current thread.
pthread_exit
void pthread_exit(void *retval) NORETURN
Exit calling pthread.
pthread_equal
static int pthread_equal(pthread_t thread1, pthread_t thread2)
Compared two pthread identifiers.
Definition: pthread_threading.h:101
pthread_create
int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Spawn a new POSIX thread.
NORETURN
#define NORETURN
The NORETURN keyword tells the compiler to assume that the function cannot return.
Definition: kernel_defines.h:74
pthread_detach
int pthread_detach(pthread_t th)
Make a pthread unjoinable.