1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Thread API Support |
---|
5 | * |
---|
6 | * This defines the POSIX thread API extension. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2011. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_POSIX_THREADSUP_H |
---|
19 | #define _RTEMS_POSIX_THREADSUP_H |
---|
20 | |
---|
21 | #include <sys/signal.h> |
---|
22 | #include <rtems/score/coresem.h> |
---|
23 | #include <rtems/score/tqdata.h> |
---|
24 | |
---|
25 | /** |
---|
26 | * @defgroup POSIX_THREAD Thread API Extension |
---|
27 | * |
---|
28 | * @ingroup POSIX |
---|
29 | * |
---|
30 | * @{ |
---|
31 | */ |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" { |
---|
34 | #endif |
---|
35 | |
---|
36 | /** |
---|
37 | * This defines the POSIX API support structure associated with |
---|
38 | * each thread in a system with POSIX configured. |
---|
39 | */ |
---|
40 | typedef struct { |
---|
41 | /** This is the POSIX threads attribute set. */ |
---|
42 | pthread_attr_t Attributes; |
---|
43 | /** This indicates whether the thread is attached or detached. */ |
---|
44 | int detachstate; |
---|
45 | /** This is the set of threads waiting for the thread to exit. */ |
---|
46 | Thread_queue_Control Join_List; |
---|
47 | /** This is the thread's current scheduling policy. */ |
---|
48 | int schedpolicy; |
---|
49 | /** This is the thread's current set of scheduling parameters. */ |
---|
50 | struct sched_param schedparam; |
---|
51 | /** |
---|
52 | * This is the high priority to execute at when using the sporadic |
---|
53 | * scheduler. |
---|
54 | */ |
---|
55 | int ss_high_priority; |
---|
56 | /** |
---|
57 | * This is the timer which controls when the thread executes at |
---|
58 | * high and low priority when using the sporadic scheduler. |
---|
59 | */ |
---|
60 | Watchdog_Control Sporadic_timer; |
---|
61 | |
---|
62 | /** This is the set of signals which are currently blocked. */ |
---|
63 | sigset_t signals_blocked; |
---|
64 | /** This is the set of signals which are currently pending. */ |
---|
65 | sigset_t signals_pending; |
---|
66 | |
---|
67 | /*******************************************************************/ |
---|
68 | /*******************************************************************/ |
---|
69 | /*************** POSIX Cancelability ***************/ |
---|
70 | /*******************************************************************/ |
---|
71 | /*******************************************************************/ |
---|
72 | |
---|
73 | /** This is the cancelability state. */ |
---|
74 | int cancelability_state; |
---|
75 | /** This is the cancelability type. */ |
---|
76 | int cancelability_type; |
---|
77 | /** This indicates if a cancelation has been requested. */ |
---|
78 | int cancelation_requested; |
---|
79 | /** This is the set of cancelation handlers. */ |
---|
80 | Chain_Control Cancellation_Handlers; |
---|
81 | |
---|
82 | } POSIX_API_Control; |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief POSIX thread exit shared helper. |
---|
86 | * |
---|
87 | * 16.1.5.1 Thread Termination, p1003.1c/Draft 10, p. 150 |
---|
88 | * |
---|
89 | * This method is a helper routine which ensures that all |
---|
90 | * POSIX thread calls which result in a thread exiting will |
---|
91 | * do so in the same manner. |
---|
92 | * |
---|
93 | * @param[in] the_thread is a pointer to the thread exiting or being canceled |
---|
94 | * @param[in] value_ptr is a pointer the value to be returned by the thread |
---|
95 | * |
---|
96 | * NOTE: Key destructors are executed in the POSIX api delete extension. |
---|
97 | * |
---|
98 | */ |
---|
99 | void _POSIX_Thread_Exit( |
---|
100 | Thread_Control *the_thread, |
---|
101 | void *value_ptr |
---|
102 | ); |
---|
103 | |
---|
104 | /** @} */ |
---|
105 | |
---|
106 | #ifdef __cplusplus |
---|
107 | } |
---|
108 | #endif |
---|
109 | |
---|
110 | #endif |
---|
111 | /* end of include file */ |
---|