]> rtime.felk.cvut.cz Git - l4.git/blob - l4/doc/source/pthreads.dox
Inital import
[l4.git] / l4 / doc / source / pthreads.dox
1 // vi:ft=c
2 /**
3
4 \page l4re_pthreads Pthread Support
5
6 L4Re supports the standard pthread library functionality. Therefore L4Re
7 itself does not contain any documentation for pthreads itself. Please refer
8 to the standard pthread documentation instead.
9
10 The L4Re specific parts will be described herein.
11
12 <ul>
13   <li>
14     Include pthread-l4.h header file:
15   \code
16    #include <pthread-l4.h>
17   \endcode
18
19   </li>
20   <li>Return the local thread capability of a pthread thread:
21
22   Use \c pthread_getl4cap(pthread_t *t) to get the capability index of
23   the pthread t.
24
25   For example:
26   \code
27   pthread_getl4cap(pthread_self());
28   \endcode
29   </li>
30
31   <li> Setting the L4 priority of an L4 thread works with a special
32        scheduling policy (other policies do not affect the L4 thread
33        priority):
34
35   \code
36   pthread_t t;
37   pthread_attr_t a;
38   struct sched_param sp;
39
40   pthread_attr_init(&a);
41   sp.sched_priority = l4_priority;
42   pthread_attr_setschedpolicy(&a, SCHED_L4);
43   pthread_attr_setschedparam(&a, &sp);
44   pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED);
45
46   if (pthread_create(&t, &a, pthread_func, NULL))
47     // failure...
48
49   pthread_attr_destroy(&a);
50   \endcode
51
52   </li>
53 </ul>
54
55
56
57
58 */