Changeset 4600bd7c in rtems
- Timestamp:
- 12/09/13 18:53:24 (10 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 71f2a83d
- Parents:
- 1de916b4
- git-author:
- Joel Sherrill <joel.sherrill@…> (12/09/13 18:53:24)
- git-committer:
- Joel Sherrill <joel.sherrill@…> (12/10/13 01:50:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/posix/include/rtems/posix/muteximpl.h
r1de916b4 r4600bd7c 8 8 */ 9 9 10 /* COPYRIGHT (c) 1989-201 1.10 /* COPYRIGHT (c) 1989-2013. 11 11 * On-Line Applications Research Corporation (OAR). 12 12 * … … 28 28 #endif 29 29 30 /* 30 /** 31 31 * The following defines the information control block used to manage 32 32 * this class of objects. 33 33 */ 34 35 34 POSIX_EXTERN Objects_Information _POSIX_Mutex_Information; 36 35 37 /* 36 /** 38 37 * The default mutex attributes structure. 39 38 */ 40 41 39 POSIX_EXTERN pthread_mutexattr_t _POSIX_Mutex_Default_attributes; 42 40 41 /** 42 * This array contains a mapping from Score Mutex return codes to 43 * POSIX return codes. 44 */ 43 45 extern const int _POSIX_Mutex_Return_codes[CORE_MUTEX_STATUS_LAST + 1]; 44 46 45 /* 47 /** 46 48 * @brief POSIX Mutex Manager Initialization 47 *48 * DESCRIPTION:49 49 * 50 50 * This routine performs the initialization necessary for this manager. 51 51 */ 52 53 52 void _POSIX_Mutex_Manager_initialization(void); 54 53 55 /* 56 * _POSIX_Mutex_Allocate 57 * 58 * DESCRIPTION: 54 /** 55 * @brief POSIX Mutex Allocate 59 56 * 60 57 * This function allocates a mutexes control block from 61 58 * the inactive chain of free mutexes control blocks. 62 59 */ 60 RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void ) 61 { 62 return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information ); 63 } 63 64 64 RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void ); 65 66 /* 67 * _POSIX_Mutex_Free 68 * 69 * DESCRIPTION: 65 /** 66 * @brief POSIX Mutex Free 70 67 * 71 68 * This routine frees a mutexes control block to the 72 69 * inactive chain of free mutexes control blocks. 73 70 */ 71 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free( 72 POSIX_Mutex_Control *the_mutex 73 ) 74 { 75 _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object ); 76 } 74 77 75 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (76 POSIX_Mutex_Control *the_mutex77 );78 78 79 #if 0 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 bool _POSIX_Mutex_Is_null ( 108 POSIX_Mutex_Control *the_mutex 109 ); 110 #endif 111 112 /* 113 * _POSIX_Mutex_Lock_support 114 * 115 * DESCRIPTION: 79 /** 80 * @brief POSIX Mutex Lock Support Method 116 81 * 117 82 * A support routine which implements guts of the blocking, non-blocking, and 118 83 * timed wait version of mutex lock. 119 84 */ 120 121 85 int _POSIX_Mutex_Lock_support( 122 86 pthread_mutex_t *mutex, … … 126 90 127 91 /** 128 * @brief Convert core mutex status codes into the appropriate POSIX status 129 * values. 130 * 131 * DESCRIPTION: 92 * @brief Convert Score mutex status codes into POSIX status values 132 93 * 133 94 * A support routine which converts core mutex status codes into the … … 138 99 * @retval 0 Mutex status code indicates the operation completed successfully. 139 100 * @retval EBUSY Mutex status code indicates that the operation unable to 140 * complete immediately because the resource was unavailable.101 * complete immediately because the resource was unavailable. 141 102 * @retval EDEADLK Mutex status code indicates that an attempt was made to 142 * relock a mutex for which nesting is not configured.103 * relock a mutex for which nesting is not configured. 143 104 * @retval EPERM Mutex status code indicates that an attempt was made to 144 * release a mutex by a thread other than the thread which locked it.105 * release a mutex by a thread other than the thread which locked it. 145 106 * @retval EINVAL Mutex status code indicates that the thread was blocked 146 * waiting for an operation to complete and the mutex was deleted.107 * waiting for an operation to complete and the mutex was deleted. 147 108 * @retval ETIMEDOUT Mutex status code indicates that the calling task was 148 * willing to block but the operation was unable to complete within the time 149 * allotted because the resource never became available. 109 * willing to block but the operation was unable to complete 110 * within the time allotted because the resource never became 111 * available. 150 112 */ 151 113 RTEMS_INLINE_ROUTINE int _POSIX_Mutex_Translate_core_mutex_return_code( … … 163 125 } 164 126 165 /* 166 * _POSIX_Mutex_Get 167 * 168 * DESCRIPTION: 127 /** 128 * @brief POSIX Mutex Get (Thread Dispatch Disable) 169 129 * 170 130 * A support routine which translates the mutex id into a local pointer. 171 131 * As a side-effect, it may create the mutex. 172 132 * 173 * NOTE: 174 * 175 * This version of the method uses a dispatching critical section. 133 * @note This version of the method uses a dispatching critical section. 176 134 */ 177 178 135 POSIX_Mutex_Control *_POSIX_Mutex_Get ( 179 136 pthread_mutex_t *mutex, … … 181 138 ); 182 139 183 /* 184 * _POSIX_Mutex_Get 185 * 186 * DESCRIPTION: 140 /** 141 * @brief POSIX Mutex Get (Interrupt Disable) 187 142 * 188 143 * A support routine which translates the mutex id into a local pointer. 189 144 * As a side-effect, it may create the mutex. 190 145 * 191 * NOTE: 192 * 193 * This version of the method uses an interrupt critical section. 146 * @note: This version of the method uses an interrupt critical section. 194 147 */ 195 196 148 POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable ( 197 149 pthread_mutex_t *mutex, … … 200 152 ); 201 153 202 /* 203 * _POSIX_Mutex_Allocate 154 /** 155 * @brief POSIX Mutex Is NULL 156 * 157 * This method is used to determine if a pointer to a POSIX mutex is NULL. 158 * 159 * @return This method returns TRUE if @a the_mutex is NULL and FALSE 160 * otherwise. 204 161 */ 205 206 RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )207 {208 return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );209 }210 211 /*212 * _POSIX_Mutex_Free213 */214 215 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (216 POSIX_Mutex_Control *the_mutex217 )218 {219 _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );220 }221 222 /*223 * _POSIX_Mutex_Is_null224 */225 226 162 RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_null ( 227 163 POSIX_Mutex_Control *the_mutex
Note: See TracChangeset
for help on using the changeset viewer.