Xenomai 3.3.2
Loading...
Searching...
No Matches
pthread.h
1/*
2 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18#pragma GCC system_header
19#include_next <pthread.h>
20
21#ifndef _COBALT_PTHREAD_H
22#define _COBALT_PTHREAD_H
23
24#include <boilerplate/libc.h>
25#include <cobalt/wrappers.h>
26#include <cobalt/uapi/thread.h>
27
28typedef struct pthread_attr_ex {
29 pthread_attr_t std;
30 struct {
31 int personality;
32 int sched_policy;
33 struct sched_param_ex sched_param;
34 } nonstd;
35} pthread_attr_ex_t;
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41COBALT_DECL(int, pthread_attr_init, (pthread_attr_t *attr));
42
43COBALT_DECL(int, pthread_create,
44 (pthread_t *ptid_r, const pthread_attr_t *attr,
45 void *(*start)(void *), void *arg));
46
47COBALT_DECL(int, pthread_getschedparam,
48 (pthread_t thread, int *policy, struct sched_param *param));
49
50COBALT_DECL(int, pthread_setschedparam,
51 (pthread_t thread, int policy, const struct sched_param *param));
52
53COBALT_DECL(int, pthread_setschedprio, (pthread_t thread, int prio));
54
55COBALT_DECL(int, pthread_mutex_init,
56 (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr));
57
58COBALT_DECL(int, pthread_mutex_destroy, (pthread_mutex_t *mutex));
59
60COBALT_DECL(int, pthread_mutex_lock, (pthread_mutex_t *mutex));
61
62COBALT_DECL_TIME64(int, pthread_mutex_timedlock, __pthread_mutex_timedlock64,
63 (pthread_mutex_t *mutex, const struct timespec *to));
64
65COBALT_DECL(int, pthread_mutex_trylock, (pthread_mutex_t *mutex));
66
67COBALT_DECL(int, pthread_mutex_unlock, (pthread_mutex_t *mutex));
68
69COBALT_DECL(int, pthread_mutex_setprioceiling,
70 (pthread_mutex_t *__restrict mutex, int prioceiling,
71 int *__restrict old_ceiling));
72
73COBALT_DECL(int, pthread_mutex_getprioceiling,
74 (pthread_mutex_t *__restrict mutex, int *__restrict old_ceiling));
75
76COBALT_DECL(int, pthread_cond_init,
77 (pthread_cond_t *cond, const pthread_condattr_t *attr));
78
79COBALT_DECL(int, pthread_cond_destroy, (pthread_cond_t *cond));
80
81COBALT_DECL(int, pthread_cond_wait,
82 (pthread_cond_t *cond, pthread_mutex_t *mutex));
83
84COBALT_DECL_TIME64(int, pthread_cond_timedwait, __pthread_cond_timedwait64,
85 (pthread_cond_t *cond, pthread_mutex_t *mutex,
86 const struct timespec *abstime));
87
88COBALT_DECL(int, pthread_cond_signal, (pthread_cond_t *cond));
89
90COBALT_DECL(int, pthread_cond_broadcast, (pthread_cond_t *cond));
91
92COBALT_DECL(int, pthread_kill, (pthread_t ptid, int sig));
93
94COBALT_DECL(int, pthread_join, (pthread_t ptid, void **retval));
95
96#ifndef pthread_yield
97/*
98 * linuxthreads wraps pthread_yield() to sched_yield() via a
99 * preprocessor macro, which confuses the compiler with
100 * COBALT_DECL(). Since Cobalt also routes pthread_yield() to its own
101 * sched_yield() implementation internally, we can live with this
102 * wrapping.
103 */
104COBALT_DECL(int, pthread_yield, (void));
105#endif
106
107int pthread_setmode_np(int clrmask, int setmask,
108 int *mask_r);
109
110COBALT_DECL(int, pthread_setname_np, (pthread_t thread, const char *name));
111
112int pthread_create_ex(pthread_t *ptid_r,
113 const pthread_attr_ex_t *attr_ex,
114 void *(*start)(void *),
115 void *arg);
116
117int pthread_getschedparam_ex(pthread_t ptid,
118 int *pol,
119 struct sched_param_ex *par);
120
121int pthread_setschedparam_ex(pthread_t ptid,
122 int pol,
123 const struct sched_param_ex *par);
124
125int pthread_attr_init_ex(pthread_attr_ex_t *attr_ex);
126
127int pthread_attr_destroy_ex(pthread_attr_ex_t *attr_ex);
128
129int pthread_attr_setschedpolicy_ex(pthread_attr_ex_t *attr_ex,
130 int policy);
131
132int pthread_attr_getschedpolicy_ex(const pthread_attr_ex_t *attr_ex,
133 int *policy);
134
135int pthread_attr_setschedparam_ex(pthread_attr_ex_t *attr_ex,
136 const struct sched_param_ex *param_ex);
137
138int pthread_attr_getschedparam_ex(const pthread_attr_ex_t *attr_ex,
139 struct sched_param_ex *param_ex);
140
141int pthread_attr_getinheritsched_ex(const pthread_attr_ex_t *attr_ex,
142 int *inheritsched);
143
144int pthread_attr_setinheritsched_ex(pthread_attr_ex_t *attr_ex,
145 int inheritsched);
146
147int pthread_attr_getdetachstate_ex(const pthread_attr_ex_t *attr_ex,
148 int *detachstate);
149
150int pthread_attr_setdetachstate_ex(pthread_attr_ex_t *attr_ex,
151 int detachstate);
152
153int pthread_attr_setdetachstate_ex(pthread_attr_ex_t *attr_ex,
154 int detachstate);
155
156int pthread_attr_getstacksize_ex(const pthread_attr_ex_t *attr_ex,
157 size_t *stacksize);
158
159int pthread_attr_setstacksize_ex(pthread_attr_ex_t *attr_ex,
160 size_t stacksize);
161
162int pthread_attr_getscope_ex(const pthread_attr_ex_t *attr_ex,
163 int *scope);
164
165int pthread_attr_setscope_ex(pthread_attr_ex_t *attr_ex,
166 int scope);
167
168int pthread_attr_getpersonality_ex(const pthread_attr_ex_t *attr_ex,
169 int *personality);
170
171int pthread_attr_setpersonality_ex(pthread_attr_ex_t *attr_ex,
172 int personality);
173
174int pthread_mutex_lock_interruptible_np(pthread_mutex_t *mutex);
175
176int pthread_timedmutex_lock_interruptible_np(pthread_mutex_t *mutex, const struct timespec *to);
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif /* !_COBALT_PTHREAD_H */
int pthread_cond_signal(pthread_cond_t *cond))
Signal a condition variable.
Definition cond.c:457
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex))
Wait on a condition variable.
Definition cond.c:297
int pthread_cond_destroy(pthread_cond_t *cond))
Destroy a condition variable.
Definition cond.c:200
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr))
Initialize a condition variable.
Definition cond.c:120
int pthread_cond_broadcast(pthread_cond_t *cond))
Broadcast a condition variable.
Definition cond.c:512
int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict mutex, int prioceiling, int *__restrict old_ceiling))
Set a mutex's priority ceiling.
Definition mutex.c:741
int pthread_mutex_trylock(pthread_mutex_t *mutex))
Attempt to lock a mutex.
Definition mutex.c:554
int pthread_mutex_destroy(pthread_mutex_t *mutex))
Destroy a mutex.
Definition mutex.c:270
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr))
Initialize a mutex.
Definition mutex.c:117
int pthread_mutex_getprioceiling(pthread_mutex_t *__restrict mutex, int *__restrict old_ceiling))
Get a mutex's priority ceiling.
Definition mutex.c:792
int pthread_mutex_unlock(pthread_mutex_t *mutex))
Unlock a mutex.
Definition mutex.c:650
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param))
Set the scheduling policy and parameters of the specified thread.
Definition thread.c:540
int pthread_setschedparam_ex(pthread_t ptid, int pol, const struct sched_param_ex *par)
Set extended scheduling policy of thread.
Definition thread.c:603
int pthread_yield(void))
Yield the processor.
Definition thread.c:799
int pthread_join(pthread_t ptid, void **retval))
Wait for termination of a specified thread.
Definition thread.c:479
int pthread_kill(pthread_t ptid, int sig))
Send a signal to a thread.
Definition thread.c:431
int pthread_setname_np(pthread_t thread, const char *name))
Set a thread name.
Definition thread.c:403
int pthread_create(pthread_t *ptid_r, const pthread_attr_t *attr, void *(*start)(void *), void *arg))
Create a new thread.
Definition thread.c:274
int pthread_setmode_np(int clrmask, int setmask, int *mask_r)
Set the mode of the current thread.
Definition thread.c:379