1 #pragma once
2 
3 #include <l4/sys/compiler.h>
4 #include <l4/sys/types.h>
5 #include <pthread.h>
6 
7 enum
8 {
9   PTHREAD_L4_ATTR_NO_START = 0x0001,
10 };
11 
12 __BEGIN_DECLS
13 
14 l4_cap_idx_t pthread_l4_cap(pthread_t t);
15 
16 void pthread_l4_for_each_thread(void (*fn)(pthread_t));
17 
18 static inline l4_utcb_t *pthread_l4_utcb(pthread_t t);
19 
20 int pthread_l4_start(pthread_t thread, void *(*func)(void *), void *arg);
21 
22 __END_DECLS
23 
24 #ifdef __cplusplus
25 #include <l4/sys/thread>
26 
27 namespace Pthread { namespace L4 {
28 
cap(pthread_t t)29 inline ::L4::Cap< ::L4::Thread> cap(pthread_t t)
30 { return ::L4::Cap< ::L4::Thread>(pthread_l4_cap(t)); }
31 
utcb(pthread_t t)32 inline l4_utcb_t *utcb(pthread_t t)
33 { return pthread_l4_utcb(t); }
34 
start(pthread_t thread,void * (* start_routine)(void *),void * arg)35 inline int start(pthread_t thread, void *(*start_routine)(void *), void *arg)
36 { return pthread_l4_start(thread, start_routine, arg); }
37 
38 
39 }} // namespace L4, namespace Pthread
40 
41 #endif
42 
43 /* Implementations */
44 
45 static inline
46 l4_utcb_t *
pthread_l4_utcb(pthread_t t)47 pthread_l4_utcb(pthread_t t)
48 { return (l4_utcb_t *) t; }
49 
50 /* Deprecated version of pthread_l4_cap() */
pthread_getl4cap(pthread_t t)51 static inline l4_cap_idx_t pthread_getl4cap(pthread_t t)
52 { return pthread_l4_cap(t); }
53