5
Last change
on this file since 1d572eba was
de59c065,
checked in by Sebastian Huber <sebastian.huber@…>, on 09/27/17 at 13:08:33
|
posix: Implement self-contained POSIX mutex
POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.
Update #2514.
Update #3112.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Returns the Current Priority Ceiling of the Mutex |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/posix/muteximpl.h> |
---|
22 | #include <rtems/posix/priorityimpl.h> |
---|
23 | |
---|
24 | /* |
---|
25 | * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 |
---|
26 | */ |
---|
27 | |
---|
28 | int pthread_mutex_getprioceiling( |
---|
29 | pthread_mutex_t *mutex, |
---|
30 | int *prioceiling |
---|
31 | ) |
---|
32 | { |
---|
33 | POSIX_Mutex_Control *the_mutex; |
---|
34 | unsigned long flags; |
---|
35 | Thread_queue_Context queue_context; |
---|
36 | |
---|
37 | if ( prioceiling == NULL ) { |
---|
38 | return EINVAL; |
---|
39 | } |
---|
40 | |
---|
41 | the_mutex = _POSIX_Mutex_Get( mutex ); |
---|
42 | POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags ); |
---|
43 | |
---|
44 | _POSIX_Mutex_Acquire( the_mutex, &queue_context ); |
---|
45 | |
---|
46 | if ( _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_CEILING ) { |
---|
47 | *prioceiling = _POSIX_Priority_From_core( |
---|
48 | _POSIX_Mutex_Get_scheduler( the_mutex ), |
---|
49 | _POSIX_Mutex_Get_priority( the_mutex ) |
---|
50 | ); |
---|
51 | } else { |
---|
52 | *prioceiling = 0; |
---|
53 | } |
---|
54 | |
---|
55 | _POSIX_Mutex_Release( the_mutex, &queue_context ); |
---|
56 | return 0; |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.