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