source: rtems/cpukit/posix/include/rtems/posix/condimpl.h @ a2e3f33

4.115
Last change on this file since a2e3f33 was a2e3f33, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:50:54

score: Create object implementation header

Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @file rtems/posix/cond.inl
3 *
4 * This include file contains the static inline implementation of the private
5 * inlined routines for POSIX condition variables.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifndef _RTEMS_POSIX_CONDIMPL_H
18#define _RTEMS_POSIX_CONDIMPL_H
19 
20#include <rtems/posix/cond.h>
21#include <rtems/score/objectimpl.h>
22#include <rtems/score/watchdog.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 *  Constant to indicate condition variable does not currently have
30 *  a mutex assigned to it.
31 */
32
33#define POSIX_CONDITION_VARIABLES_NO_MUTEX 0
34
35/*
36 *  The following defines the information control block used to manage
37 *  this class of objects.
38 */
39
40POSIX_EXTERN Objects_Information  _POSIX_Condition_variables_Information;
41
42/*
43 *  The default condition variable attributes structure.
44 */
45
46extern const pthread_condattr_t _POSIX_Condition_variables_Default_attributes;
47
48/*
49 * @brief Initialization Necessary for this Manager
50 *
51 *  _POSIX_Condition_variables_Manager_initialization
52 *
53 *  DESCRIPTION:
54 *
55 *  This routine performs the initialization necessary for this manager.
56 */
57
58void _POSIX_Condition_variables_Manager_initialization(void);
59
60/*
61 *  _POSIX_Condition_variables_Allocate
62 *
63 *  DESCRIPTION:
64 *
65 *  This function allocates a condition variable control block from
66 *  the inactive chain of free condition variable control blocks.
67 */
68
69RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *
70  _POSIX_Condition_variables_Allocate( void );
71
72/*
73 *  _POSIX_Condition_variables_Free
74 *
75 *  DESCRIPTION:
76 *
77 *  This routine frees a condition variable control block to the
78 *  inactive chain of free condition variable control blocks.
79 */
80
81RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
82  POSIX_Condition_variables_Control *the_condition_variable
83);
84
85/*
86 *  _POSIX_Condition_variables_Get
87 *
88 *  DESCRIPTION:
89 *
90 *  This function maps condition variable IDs to condition variable control
91 *  blocks.  If ID corresponds to a local condition variable, then it returns
92 *  the_condition variable control pointer which maps to ID and location
93 *  is set to OBJECTS_LOCAL.  if the condition variable ID is global and
94 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
95 *  and the_condition variable is undefined.  Otherwise, location is set
96 *  to OBJECTS_ERROR and the_condition variable is undefined.
97 */
98
99#if 0
100RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
101  Objects_Id        *id,
102  Objects_Locations *location
103);
104#endif
105
106/*
107 *  _POSIX_Condition_variables_Is_null
108 *
109 *  DESCRIPTION:
110 *
111 *  This function returns TRUE if the_condition variable is NULL
112 *  and FALSE otherwise.
113 */
114
115RTEMS_INLINE_ROUTINE bool _POSIX_Condition_variables_Is_null (
116  POSIX_Condition_variables_Control *the_condition_variable
117);
118
119/**
120 * @brief Implements wake up version of the "signal" operation.
121 *
122 * DESCRIPTION:
123 *
124 * A support routine which implements guts of the broadcast and single task
125 * wake up version of the "signal" operation.
126 */
127int _POSIX_Condition_variables_Signal_support(
128  pthread_cond_t            *cond,
129  bool                       is_broadcast
130);
131
132/**
133 * @brief POSIX condition variables wait support.
134 *
135 * DESCRIPTION:
136 *
137 * A support routine which implements guts of the blocking, non-blocking, and
138 * timed wait version of condition variable wait routines.
139 */
140int _POSIX_Condition_variables_Wait_support(
141  pthread_cond_t            *cond,
142  pthread_mutex_t           *mutex,
143  Watchdog_Interval          timeout,
144  bool                       already_timedout
145);
146
147/*
148 *  _POSIX_Condition_variables_Get
149 *
150 *  DESCRIPTION:
151 *
152 *  A support routine which translates the condition variable id into
153 *  a local pointer.  As a side-effect, it may create the condition
154 *  variable.
155 */
156
157POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
158  pthread_cond_t    *cond,
159  Objects_Locations *location
160);
161
162/*
163 *  _POSIX_Condition_variables_Allocate
164 */
165 
166RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control
167  *_POSIX_Condition_variables_Allocate( void )
168{
169  return (POSIX_Condition_variables_Control *)
170    _Objects_Allocate( &_POSIX_Condition_variables_Information );
171}
172 
173/*
174 *  _POSIX_Condition_variables_Free
175 */
176 
177RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
178  POSIX_Condition_variables_Control *the_condition_variable
179)
180{
181  _Objects_Free(
182    &_POSIX_Condition_variables_Information,
183    &the_condition_variable->Object
184  );
185}
186 
187/*
188 *  _POSIX_Condition_variables_Is_null
189 */
190 
191RTEMS_INLINE_ROUTINE bool _POSIX_Condition_variables_Is_null (
192  POSIX_Condition_variables_Control *the_condition_variable
193)
194{
195  return !the_condition_variable;
196}
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif
203/*  end of include file */
Note: See TracBrowser for help on using the repository browser.