1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Inlined Routines from the POSIX RWLock Manager |
---|
5 | * |
---|
6 | * This file contains the static inlin implementation of the inlined |
---|
7 | * routines from the POSIX RWLock Manager. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2011. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_POSIX_RWLOCKIMPL_H |
---|
20 | #define _RTEMS_POSIX_RWLOCKIMPL_H |
---|
21 | |
---|
22 | #include <rtems/posix/rwlock.h> |
---|
23 | #include <rtems/score/corerwlockimpl.h> |
---|
24 | #include <rtems/score/objectimpl.h> |
---|
25 | |
---|
26 | #include <pthread.h> |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif |
---|
31 | |
---|
32 | /** |
---|
33 | * The following defines the information control block used to manage |
---|
34 | * this class of objects. |
---|
35 | */ |
---|
36 | |
---|
37 | extern Objects_Information _POSIX_RWLock_Information; |
---|
38 | |
---|
39 | /** |
---|
40 | * @brief POSIX translate core RWLock return code. |
---|
41 | * |
---|
42 | * This routine translates SuperCore RWLock status codes into the |
---|
43 | * corresponding POSIX ones. |
---|
44 | * |
---|
45 | * |
---|
46 | * @param[in] the_RWLock_status is the SuperCore status. |
---|
47 | * |
---|
48 | * @return the corresponding POSIX status |
---|
49 | * @retval 0 The status indicates that the operation completed successfully. |
---|
50 | * @retval EINVAL The status indicates that the thread was blocked waiting for |
---|
51 | * an operation to complete and the RWLock was deleted. |
---|
52 | * @retval EBUSY This status indicates that the RWLock was not |
---|
53 | * immediately available. |
---|
54 | * @retval ETIMEDOUT This status indicates that the calling task was |
---|
55 | * willing to block but the operation was unable to complete within |
---|
56 | * the time allotted because the resource never became available. |
---|
57 | */ |
---|
58 | int _POSIX_RWLock_Translate_core_RWLock_return_code( |
---|
59 | CORE_RWLock_Status the_RWLock_status |
---|
60 | ); |
---|
61 | |
---|
62 | /** |
---|
63 | * @brief Allocate a RWLock control block. |
---|
64 | * |
---|
65 | * This function allocates a RWLock control block from |
---|
66 | * the inactive chain of free RWLock control blocks. |
---|
67 | */ |
---|
68 | RTEMS_INLINE_ROUTINE POSIX_RWLock_Control *_POSIX_RWLock_Allocate( void ) |
---|
69 | { |
---|
70 | return (POSIX_RWLock_Control *) |
---|
71 | _Objects_Allocate( &_POSIX_RWLock_Information ); |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief Free a RWLock control block. |
---|
76 | * |
---|
77 | * This routine frees a RWLock control block to the |
---|
78 | * inactive chain of free RWLock control blocks. |
---|
79 | */ |
---|
80 | RTEMS_INLINE_ROUTINE void _POSIX_RWLock_Free ( |
---|
81 | POSIX_RWLock_Control *the_RWLock |
---|
82 | ) |
---|
83 | { |
---|
84 | _CORE_RWLock_Destroy( &the_RWLock->RWLock ); |
---|
85 | _Objects_Free( &_POSIX_RWLock_Information, &the_RWLock->Object ); |
---|
86 | } |
---|
87 | |
---|
88 | POSIX_RWLock_Control *_POSIX_RWLock_Get( |
---|
89 | pthread_rwlock_t *rwlock, |
---|
90 | Objects_Locations *location |
---|
91 | ); |
---|
92 | |
---|
93 | #ifdef __cplusplus |
---|
94 | } |
---|
95 | #endif |
---|
96 | |
---|
97 | #endif |
---|
98 | /* end of include file */ |
---|