source: rtems/cpukit/posix/include/rtems/posix/threadsup.h @ b5c9064

4.11
Last change on this file since b5c9064 was b5c9064, checked in by Zhongwei Yao <ashi08104@…>, on Aug 5, 2013 at 1:20:45 PM

Unlimited objects support for POSIX keys

This patch enables unlimited model in POSIX key manger and have a decent
runtime on POSIX key searching, adding and deleting operations. Memory
overhead is lower than current implementation when the size of key and key
value becomes big.

  • Property mode set to 100644
File size: 3.6 KB
Line 
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 <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
37extern "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 */
44typedef struct {
45  /** This is the POSIX threads attribute set. */
46  pthread_attr_t          Attributes;
47  /** This indicates whether the thread is attached or detached. */
48  int                     detachstate;
49  /** This is the set of threads waiting for the thread to exit. */
50  Thread_queue_Control    Join_List;
51  /** This is the thread's current scheduling policy. */
52  int                     schedpolicy;
53  /** This is the thread's current set of scheduling parameters. */
54  struct sched_param      schedparam;
55  /**
56   * This is the high priority to execute at when using the sporadic
57   * scheduler.
58   */
59  int                     ss_high_priority;
60  /**
61   * This is the timer which controls when the thread executes at
62   * high and low priority when using the sporadic scheduler.
63   */
64  Watchdog_Control        Sporadic_timer;
65
66  /** This is the set of signals which are currently blocked. */
67  sigset_t                signals_blocked;
68  /** This is the set of signals which are currently pending. */
69  sigset_t                signals_pending;
70
71  /*******************************************************************/
72  /*******************************************************************/
73  /***************         POSIX Cancelability         ***************/
74  /*******************************************************************/
75  /*******************************************************************/
76
77  /** This is the cancelability state. */
78  int                     cancelability_state;
79  /** This is the cancelability type. */
80  int                     cancelability_type;
81  /** This indicates if a cancelation has been requested. */
82  int                     cancelation_requested;
83  /** This is the set of cancelation handlers. */
84  Chain_Control           Cancellation_Handlers;
85
86  /**
87   * This is the thread key value chain's control, which is used
88   * to track all key value for specific thread, and when thread
89   * exits, we can remove all key value for specific thread by
90   * iterating this chain, or we have to search a whole rbtree,
91   * which is inefficient.
92   */
93  Chain_Control           Key_Chain;
94
95} POSIX_API_Control;
96
97/**
98 * @brief POSIX thread exit shared helper.
99 *
100 * 16.1.5.1 Thread Termination, p1003.1c/Draft 10, p. 150
101 *
102 * This method is a helper routine which ensures that all
103 * POSIX thread calls which result in a thread exiting will
104 * do so in the same manner.
105 *
106 * @param[in] the_thread is a pointer to the thread exiting or being canceled
107 * @param[in] value_ptr is a pointer the value to be returned by the thread
108 *
109 * NOTE: Key destructors are executed in the POSIX api delete extension.
110 *
111 */
112void _POSIX_Thread_Exit(
113  Thread_Control *the_thread,
114  void           *value_ptr
115);
116
117/** @} */
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif
124/* end of include file */
Note: See TracBrowser for help on using the repository browser.