5
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Attempt to Obtain a Read Lock on a RWLock Instance |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2008. |
---|
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/rwlockimpl.h> |
---|
22 | #include <rtems/posix/posixapi.h> |
---|
23 | |
---|
24 | int pthread_rwlock_timedrdlock( |
---|
25 | pthread_rwlock_t *rwlock, |
---|
26 | const struct timespec *abstime |
---|
27 | ) |
---|
28 | { |
---|
29 | POSIX_RWLock_Control *the_rwlock; |
---|
30 | Thread_queue_Context queue_context; |
---|
31 | Status_Control status; |
---|
32 | |
---|
33 | the_rwlock = _POSIX_RWLock_Get( rwlock ); |
---|
34 | POSIX_RWLOCK_VALIDATE_OBJECT( the_rwlock ); |
---|
35 | |
---|
36 | _Thread_queue_Context_initialize( &queue_context ); |
---|
37 | _Thread_queue_Context_set_enqueue_timeout_realtime_timespec( |
---|
38 | &queue_context, |
---|
39 | abstime |
---|
40 | ); |
---|
41 | status = _CORE_RWLock_Seize_for_reading( |
---|
42 | &the_rwlock->RWLock, |
---|
43 | true, |
---|
44 | &queue_context |
---|
45 | ); |
---|
46 | return _POSIX_Get_error( status ); |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.