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 | #include <rtems/score/coremutex.h> |
---|
25 | #include <pthread.h> |
---|
26 | |
---|
27 | /* |
---|
28 | * Data Structure used to manage a POSIX mutex |
---|
29 | */ |
---|
30 | |
---|
31 | typedef struct { |
---|
32 | Objects_Control Object; |
---|
33 | int process_shared; |
---|
34 | CORE_mutex_Control Mutex; |
---|
35 | } POSIX_Mutex_Control; |
---|
36 | |
---|
37 | /* |
---|
38 | * The following defines the information control block used to manage |
---|
39 | * this class of objects. |
---|
40 | */ |
---|
41 | |
---|
42 | POSIX_EXTERN Objects_Information _POSIX_Mutex_Information; |
---|
43 | |
---|
44 | /* |
---|
45 | * _POSIX_Mutex_Manager_initialization |
---|
46 | * |
---|
47 | * DESCRIPTION: |
---|
48 | * |
---|
49 | * This routine performs the initialization necessary for this manager. |
---|
50 | */ |
---|
51 | |
---|
52 | void _POSIX_Mutex_Manager_initialization( |
---|
53 | unsigned32 maximum_mutexes |
---|
54 | ); |
---|
55 | |
---|
56 | /* |
---|
57 | * _POSIX_Mutex_Allocate |
---|
58 | * |
---|
59 | * DESCRIPTION: |
---|
60 | * |
---|
61 | * This function allocates a mutexes control block from |
---|
62 | * the inactive chain of free mutexes control blocks. |
---|
63 | */ |
---|
64 | |
---|
65 | RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void ); |
---|
66 | |
---|
67 | /* |
---|
68 | * _POSIX_Mutex_Free |
---|
69 | * |
---|
70 | * DESCRIPTION: |
---|
71 | * |
---|
72 | * This routine frees a mutexes control block to the |
---|
73 | * inactive chain of free mutexes control blocks. |
---|
74 | */ |
---|
75 | |
---|
76 | RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free ( |
---|
77 | POSIX_Mutex_Control *the_mutex |
---|
78 | ); |
---|
79 | |
---|
80 | /* |
---|
81 | * _POSIX_Mutex_Get |
---|
82 | * |
---|
83 | * DESCRIPTION: |
---|
84 | * |
---|
85 | * This function maps mutexes IDs to mutexes control blocks. |
---|
86 | * If ID corresponds to a local mutexes, then it returns |
---|
87 | * the_mutex control pointer which maps to ID and location |
---|
88 | * is set to OBJECTS_LOCAL. if the mutexes ID is global and |
---|
89 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
90 | * and the_mutex is undefined. Otherwise, location is set |
---|
91 | * to OBJECTS_ERROR and the_mutex is undefined. |
---|
92 | */ |
---|
93 | |
---|
94 | RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get ( |
---|
95 | Objects_Id *id, |
---|
96 | Objects_Locations *location |
---|
97 | ); |
---|
98 | |
---|
99 | /* |
---|
100 | * _POSIX_Mutex_Is_null |
---|
101 | * |
---|
102 | * DESCRIPTION: |
---|
103 | * |
---|
104 | * This function returns TRUE if the_mutex is NULL and FALSE otherwise. |
---|
105 | */ |
---|
106 | |
---|
107 | RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null ( |
---|
108 | POSIX_Mutex_Control *the_mutex |
---|
109 | ); |
---|
110 | |
---|
111 | #include <rtems/posix/mutex.inl> |
---|
112 | #include <rtems/posix/mutexmp.h> |
---|
113 | |
---|
114 | #ifdef __cplusplus |
---|
115 | } |
---|
116 | #endif |
---|
117 | |
---|
118 | #endif |
---|
119 | /* end of include file */ |
---|
120 | |
---|