5
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Try to Lock 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 | int pthread_mutex_trylock( |
---|
29 | pthread_mutex_t *mutex |
---|
30 | ) |
---|
31 | { |
---|
32 | int eno; |
---|
33 | |
---|
34 | eno = _POSIX_Mutex_Lock_support( |
---|
35 | mutex, |
---|
36 | (const struct timespec *) POSIX_MUTEX_ABSTIME_TRY_LOCK, |
---|
37 | NULL |
---|
38 | ); |
---|
39 | |
---|
40 | if ( eno == EDEADLK ) { |
---|
41 | eno = EBUSY; |
---|
42 | } |
---|
43 | |
---|
44 | return eno; |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.