5
Last change
on this file since e266d13 was
e266d13,
checked in by Sebastian Huber <sebastian.huber@…>, on 05/20/16 at 13:10:27
|
Replace *_Get_interrupt_disable() with *_Get()
Uniformly use *_Get() to get an object by identifier with a lock
context.
|
-
Property mode set to
100644
|
File size:
997 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Locking and Unlocking a 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 | |
---|
23 | /* |
---|
24 | * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93 |
---|
25 | * |
---|
26 | * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 |
---|
27 | */ |
---|
28 | |
---|
29 | int pthread_mutex_unlock( |
---|
30 | pthread_mutex_t *mutex |
---|
31 | ) |
---|
32 | { |
---|
33 | POSIX_Mutex_Control *the_mutex; |
---|
34 | CORE_mutex_Status status; |
---|
35 | ISR_lock_Context lock_context; |
---|
36 | |
---|
37 | the_mutex = _POSIX_Mutex_Get( mutex, &lock_context ); |
---|
38 | |
---|
39 | if ( the_mutex == NULL ) { |
---|
40 | return EINVAL; |
---|
41 | } |
---|
42 | |
---|
43 | status = _CORE_mutex_Surrender( |
---|
44 | &the_mutex->Mutex, |
---|
45 | NULL, |
---|
46 | 0, |
---|
47 | &lock_context |
---|
48 | ); |
---|
49 | return _POSIX_Mutex_Translate_core_mutex_return_code( status ); |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.