1 | /* rtems/posix/mutex.h |
---|
2 | * |
---|
3 | * This include file contains all the private support information for |
---|
4 | * POSIX mutex's. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __RTEMS_POSIX_MUTEX_h |
---|
18 | #define __RTEMS_POSIX_MUTEX_h |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | /* |
---|
25 | * Data Structure used to manage a POSIX mutex |
---|
26 | */ |
---|
27 | |
---|
28 | typedef struct { |
---|
29 | Objects_Control Object; |
---|
30 | int process_shared; |
---|
31 | CORE_mutex_Control Mutex; |
---|
32 | } POSIX_Mutex_Control; |
---|
33 | |
---|
34 | /* |
---|
35 | * The following defines the information control block used to manage |
---|
36 | * this class of objects. |
---|
37 | */ |
---|
38 | |
---|
39 | EXTERN Objects_Information _POSIX_Mutex_Information; |
---|
40 | |
---|
41 | /* |
---|
42 | * _POSIX_Mutex_Manager_initialization |
---|
43 | * |
---|
44 | * DESCRIPTION: |
---|
45 | * |
---|
46 | * This routine performs the initialization necessary for this manager. |
---|
47 | */ |
---|
48 | |
---|
49 | void _POSIX_Mutex_Manager_initialization( |
---|
50 | unsigned32 maximum_mutexes |
---|
51 | ); |
---|
52 | |
---|
53 | /* |
---|
54 | * _POSIX_Mutex_Allocate |
---|
55 | * |
---|
56 | * DESCRIPTION: |
---|
57 | * |
---|
58 | * This function allocates a mutexes control block from |
---|
59 | * the inactive chain of free mutexes control blocks. |
---|
60 | */ |
---|
61 | |
---|
62 | STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void ); |
---|
63 | |
---|
64 | /* |
---|
65 | * _POSIX_Mutex_Free |
---|
66 | * |
---|
67 | * DESCRIPTION: |
---|
68 | * |
---|
69 | * This routine frees a mutexes control block to the |
---|
70 | * inactive chain of free mutexes control blocks. |
---|
71 | */ |
---|
72 | |
---|
73 | STATIC INLINE void _POSIX_Mutex_Free ( |
---|
74 | POSIX_Mutex_Control *the_mutex |
---|
75 | ); |
---|
76 | |
---|
77 | /* |
---|
78 | * _POSIX_Mutex_Get |
---|
79 | * |
---|
80 | * DESCRIPTION: |
---|
81 | * |
---|
82 | * This function maps mutexes IDs to mutexes control blocks. |
---|
83 | * If ID corresponds to a local mutexes, then it returns |
---|
84 | * the_mutex control pointer which maps to ID and location |
---|
85 | * is set to OBJECTS_LOCAL. if the mutexes ID is global and |
---|
86 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
87 | * and the_mutex is undefined. Otherwise, location is set |
---|
88 | * to OBJECTS_ERROR and the_mutex is undefined. |
---|
89 | */ |
---|
90 | |
---|
91 | STATIC INLINE POSIX_Mutex_Control *_POSIX_Mutex_Get ( |
---|
92 | Objects_Id *id, |
---|
93 | Objects_Locations *location |
---|
94 | ); |
---|
95 | |
---|
96 | /* |
---|
97 | * _POSIX_Mutex_Is_null |
---|
98 | * |
---|
99 | * DESCRIPTION: |
---|
100 | * |
---|
101 | * This function returns TRUE if the_mutex is NULL and FALSE otherwise. |
---|
102 | */ |
---|
103 | |
---|
104 | STATIC INLINE boolean _POSIX_Mutex_Is_null ( |
---|
105 | POSIX_Mutex_Control *the_mutex |
---|
106 | ); |
---|
107 | |
---|
108 | #include <rtems/posix/mutex.inl> |
---|
109 | #include <rtems/posix/mutexmp.h> |
---|
110 | |
---|
111 | #ifdef __cplusplus |
---|
112 | } |
---|
113 | #endif |
---|
114 | |
---|
115 | #endif |
---|
116 | /* end of include file */ |
---|
117 | |
---|