C++ Library, mos@ua  0.9
cpplib-mos
thread.h
Go to the documentation of this file.
1 
28 #ifndef THREAD_H
29 #define THREAD_H
30 
31 #include <pthread.h>
32 
33 //#define EXCEPTION_POLICY
34 //#define EXIT_POLICY // DEFAULT
35 
52 int thread_equal(pthread_t t1, pthread_t t2);
53 
66 void thread_create(pthread_t* t, pthread_attr_t* attr, void *(*thread_main)(void*), void* arg);
67 
75 pthread_t thread_self();
76 
84 void thread_sched_yield(void);
85 
93 void thread_exit(void *retval);
94 
102 void thread_detach(pthread_t thread);
103 
111 void thread_join(pthread_t t, void** result);
112 
145 void mutex_init(pthread_mutex_t* pmtx, pthread_mutexattr_t* attr);
146 
158 void mutex_destroy(pthread_mutex_t* pmtx);
159 
171 void mutex_lock(pthread_mutex_t* pmtx);
172 
186 int mutex_trylock(pthread_mutex_t* pmtx);
187 
199 void mutex_unlock(pthread_mutex_t* pmtx);
200 
231 void cond_init(pthread_cond_t* pcvar, pthread_condattr_t* attr);
232 
244 void cond_destroy(pthread_cond_t* pcvar);
245 
258 void cond_wait(pthread_cond_t* pcvar, pthread_mutex_t* pmtx);
259 
275 int cond_timedwait(pthread_cond_t* pcvar, pthread_mutex_t* pmtx, const struct timespec *abstime);
276 
288 void cond_signal(pthread_cond_t* pcvar);
289 
301 void cond_broadcast(pthread_cond_t* pcvar);
302 
342 void thread_once(pthread_once_t *once_control, void (*init_routine) (void));
343 
372 void thread_key_create(pthread_key_t *key, void (*destr_function) (void *));
373 
387 void thread_key_delete(pthread_key_t key);
388 
400 void thread_setspecific(pthread_key_t key, void* pointer);
401 
413 void* thread_getspecific(pthread_key_t key);
414 
438 void mutexattr_init(pthread_mutexattr_t *attr);
439 
451 void mutexattr_destroy(pthread_mutexattr_t *attr);
452 
464 void mutexattr_settype(pthread_mutexattr_t *attr, int type);
465 
478 void mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind);
479 
503 void condattr_init(pthread_condattr_t *attr);
504 
516 void condattr_destroy(pthread_condattr_t *attr);
517 
541 void thread_attr_init(pthread_attr_t *attr);
542 
554 void thread_attr_destroy(pthread_attr_t *attr);
555 
568 void thread_attr_setdetachstate(pthread_attr_t *attr, int detachstate);
569 
582 void thread_attr_getdetachstate(const pthread_attr_t *attr, int *pdetachstate);
583 
599 void thread_cancel(pthread_t thread);
600 
613 void thread_setcancelstate(int state, int *oldstate);
614 
627 void thread_setcanceltype(int type, int *oldtype);
628 
636 void thread_testcancel(void);
637 
638 
641 #endif
642 
643 /* ************************************************** */
647 /* ************************************************** */
648 
int thread_equal(pthread_t t1, pthread_t t2)
pthread_equal wrapper function.
pthread_t thread_self()
pthread_self wrapper function.
void thread_attr_init(pthread_attr_t *attr)
pthread_attr_init wrapper function.
void mutex_lock(pthread_mutex_t *pmtx)
pthread_mutex_lock wrapper function.
void thread_detach(pthread_t thread)
pthread_detach wrapper function.
void condattr_init(pthread_condattr_t *attr)
pthread_condattr_init wrapper function.
void mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
pthread_mutexattr_gettype wrapper function.
void mutex_init(pthread_mutex_t *pmtx, pthread_mutexattr_t *attr)
pthread_mutex_init wrapper function.
void thread_setcanceltype(int type, int *oldtype)
pthread_setcanceltype wrapper function.
void mutexattr_destroy(pthread_mutexattr_t *attr)
pthread_mutexattr_destroy wrapper function.
void thread_setcancelstate(int state, int *oldstate)
pthread_setcancelstate wrapper function.
void thread_key_delete(pthread_key_t key)
pthread_key_delete wrapper function.
void cond_wait(pthread_cond_t *pcvar, pthread_mutex_t *pmtx)
pthread_cond_wait wrapper function.
void thread_testcancel(void)
pthread_testcancel wrapper function.
void thread_key_create(pthread_key_t *key, void(*destr_function)(void *))
pthread_key_create wrapper function.
void thread_join(pthread_t t, void **result)
pthread_join wrapper function.
void thread_exit(void *retval)
pthread_exit wrapper function.
void * thread_getspecific(pthread_key_t key)
pthread_getspecific wrapper function.
void condattr_destroy(pthread_condattr_t *attr)
pthread_condattr_destroy wrapper function.
void cond_signal(pthread_cond_t *pcvar)
pthread_cond_signal wrapper function.
int cond_timedwait(pthread_cond_t *pcvar, pthread_mutex_t *pmtx, const struct timespec *abstime)
pthread_cond_timedwait wrapper function.
void thread_sched_yield(void)
sched_yield wrapper function.
void thread_cancel(pthread_t thread)
pthread_cancel wrapper function.
void cond_broadcast(pthread_cond_t *pcvar)
pthread_cond_broadcast wrapper function.
void thread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
pthread_attr_setdetachstate wrapper function.
void mutexattr_init(pthread_mutexattr_t *attr)
pthread_mutexattr_init wrapper function.
void mutex_destroy(pthread_mutex_t *pmtx)
pthread_mutex_destroy wrapper function.
void mutex_unlock(pthread_mutex_t *pmtx)
pthread_mutex_unlock wrapper function.
void thread_attr_destroy(pthread_attr_t *attr)
pthread_attr_destroy wrapper function.
void thread_create(pthread_t *t, pthread_attr_t *attr, void *(*thread_main)(void *), void *arg)
pthread_create wrapper function.
void mutexattr_settype(pthread_mutexattr_t *attr, int type)
pthread_mutexattr_settype wrapper function.
void thread_attr_getdetachstate(const pthread_attr_t *attr, int *pdetachstate)
pthread_attr_getdetachstate wrapper function.
void cond_init(pthread_cond_t *pcvar, pthread_condattr_t *attr)
pthread_cond_init wrapper function.
void thread_setspecific(pthread_key_t key, void *pointer)
pthread_setspecific wrapper function.
void cond_destroy(pthread_cond_t *pcvar)
pthread_cond_destroy wrapper function.
void thread_once(pthread_once_t *once_control, void(*init_routine)(void))
pthread_once wrapper function.
int mutex_trylock(pthread_mutex_t *pmtx)
pthread_mutex_trylock wrapper function.