source: rtems/cpukit/posix/include/rtems/posix/mutex.h @ a6608123

4.104.115
Last change on this file since a6608123 was a6608123, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/08 at 18:31:43

2008-12-14 Joel Sherrill <joel.sherrill@…>

  • itron/src/chg_pri.c, itron/src/cre_tsk.c, itron/src/rot_rdq.c, posix/Makefile.am, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/priority.h, posix/src/mutex.c, score/include/rtems/score/priority.h: Run all tests successfully with maxixum number of priorities as 16 instead of 256. This was done by temporarily modifying the score priority.h maximum. This allowed testing of all API code to ensure that it worked properly with a reduced number of priorities. Most modifications were to switch from hard-coded maximum to using the SuperCore? variable based upon configured number.
  • posix/src/mutexdefaultattributes.c: Removed.
  • Property mode set to 100644
File size: 3.9 KB
Line 
1/**
2 * @file rtems/posix/mutex.h
3 */
4
5/*
6 *  This include file contains all the private support information for
7 *  POSIX mutex's.
8 *
9 *  COPYRIGHT (c) 1989-2007.
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 *  $Id$
17 */
18
19#ifndef _RTEMS_POSIX_MUTEX_H
20#define _RTEMS_POSIX_MUTEX_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <rtems/score/coremutex.h>
27#include <pthread.h>
28
29/*
30 *  Data Structure used to manage a POSIX mutex
31 */
32
33typedef struct {
34   Objects_Control     Object;
35   int                 process_shared;
36   CORE_mutex_Control  Mutex;
37}  POSIX_Mutex_Control;
38
39/*
40 *  The following defines the information control block used to manage
41 *  this class of objects.
42 */
43
44POSIX_EXTERN Objects_Information  _POSIX_Mutex_Information;
45
46/*
47 *  The default mutex attributes structure.
48 */
49
50POSIX_EXTERN pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
51
52/*
53 *  _POSIX_Mutex_Manager_initialization
54 *
55 *  DESCRIPTION:
56 *
57 *  This routine performs the initialization necessary for this manager.
58 */
59
60void _POSIX_Mutex_Manager_initialization(
61  uint32_t   maximum_mutexes
62);
63
64/*
65 *  _POSIX_Mutex_Allocate
66 *
67 *  DESCRIPTION:
68 *
69 *  This function allocates a mutexes control block from
70 *  the inactive chain of free mutexes control blocks.
71 */
72
73RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
74
75/*
76 *  _POSIX_Mutex_Free
77 *
78 *  DESCRIPTION:
79 *
80 *  This routine frees a mutexes control block to the
81 *  inactive chain of free mutexes control blocks.
82 */
83
84RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
85  POSIX_Mutex_Control *the_mutex
86);
87
88#if 0
89/*
90 *  _POSIX_Mutex_Get
91 *
92 *  DESCRIPTION:
93 *
94 *  This function maps mutexes IDs to mutexes control blocks.
95 *  If ID corresponds to a local mutexes, then it returns
96 *  the_mutex control pointer which maps to ID and location
97 *  is set to OBJECTS_LOCAL.  if the mutexes ID is global and
98 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
99 *  and the_mutex is undefined.  Otherwise, location is set
100 *  to OBJECTS_ERROR and the_mutex is undefined.
101 */
102
103RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
104  Objects_Id        *id,
105  Objects_Locations *location
106);
107
108/*
109 *  _POSIX_Mutex_Is_null
110 *
111 *  DESCRIPTION:
112 *
113 *  This function returns TRUE if the_mutex is NULL and FALSE otherwise.
114 */
115
116RTEMS_INLINE_ROUTINE bool    _POSIX_Mutex_Is_null (
117  POSIX_Mutex_Control *the_mutex
118);
119#endif
120
121/*
122 *  _POSIX_Mutex_Lock_support
123 *
124 *  DESCRIPTION:
125 *
126 *  A support routine which implements guts of the blocking, non-blocking, and
127 *  timed wait version of mutex lock.
128 */
129
130int _POSIX_Mutex_Lock_support(
131  pthread_mutex_t           *mutex,
132  bool                       blocking,
133  Watchdog_Interval          timeout
134);
135
136/*
137 *  _POSIX_Mutex_Translate_core_mutex_return_code
138 *
139 *  DESCRIPTION:
140 *
141 *  A support routine which converts core mutex status codes into the
142 *  appropriate POSIX status values.
143 */
144
145int _POSIX_Mutex_Translate_core_mutex_return_code(
146  CORE_mutex_Status  the_mutex_status
147);
148
149
150/*
151 *  _POSIX_Mutex_Get
152 *
153 *  DESCRIPTION:
154 *
155 *  A support routine which translates the mutex id into a local pointer.
156 *  As a side-effect, it may create the mutex.
157 *
158 *  NOTE:
159 *
160 *  This version of the method uses a dispatching critical section.
161 */
162
163POSIX_Mutex_Control *_POSIX_Mutex_Get (
164  pthread_mutex_t   *mutex,
165  Objects_Locations *location
166);
167
168/*
169 *  _POSIX_Mutex_Get
170 *
171 *  DESCRIPTION:
172 *
173 *  A support routine which translates the mutex id into a local pointer.
174 *  As a side-effect, it may create the mutex.
175 *
176 *  NOTE:
177 *
178 *  This version of the method uses an interrupt critical section.
179 */
180
181POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable (
182  pthread_mutex_t   *mutex,
183  Objects_Locations *location,
184  ISR_Level         *level
185);
186
187#include <rtems/posix/mutex.inl>
188
189#ifdef __cplusplus
190}
191#endif
192
193#endif
194/*  end of include file */
Note: See TracBrowser for help on using the repository browser.