5
Last change
on this file since 127c20eb was
dce48791,
checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 11:37:59
|
score: Add Status_Control for all APIs
Unify the status codes of the Classic and POSIX API to use the new enum
Status_Control. This eliminates the Thread_Control::Wait::timeout_code
field and the timeout parameter of _Thread_queue_Enqueue_critical() and
_MPCI_Send_request_packet(). It gets rid of the status code translation
tables and instead uses simple bit operations to get the status for a
particular API. This enables translation of status code constants at
compile time. Add _Thread_Wait_get_status() to avoid direct access of
thread internal data structures.
|
-
Property mode set to
100644
|
File size:
878 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Wait at a Spinlock |
---|
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/spinlockimpl.h> |
---|
22 | #include <rtems/posix/posixapi.h> |
---|
23 | |
---|
24 | int pthread_spin_lock( pthread_spinlock_t *spinlock ) |
---|
25 | { |
---|
26 | POSIX_Spinlock_Control *the_spinlock; |
---|
27 | ISR_lock_Context lock_context; |
---|
28 | Status_Control status; |
---|
29 | |
---|
30 | the_spinlock = _POSIX_Spinlock_Get( spinlock, &lock_context ); |
---|
31 | if ( the_spinlock == NULL ) { |
---|
32 | return EINVAL; |
---|
33 | } |
---|
34 | |
---|
35 | status = _CORE_spinlock_Seize( |
---|
36 | &the_spinlock->Spinlock, |
---|
37 | true, |
---|
38 | 0, |
---|
39 | &lock_context |
---|
40 | ); |
---|
41 | return _POSIX_Get_error( status ); |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.