5
Last change
on this file since fce900b5 was
6c2b8a4b,
checked in by Sebastian Huber <sebastian.huber@…>, on 11/29/17 at 05:23:27
|
score: Use self-contained API mutex
Use a self-contained recursive mutex for API_Mutex_Control. The API
mutexes are protected against asynchronous thread cancellation.
Add dedicated mutexes for libatomic and TOD.
Close #2629.
Close #2630.
|
-
Property mode set to
100644
|
File size:
830 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Acquires the specified API mutex. |
---|
5 | * |
---|
6 | * @ingroup ScoreAPIMutex |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2007. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/score/apimutex.h> |
---|
23 | #include <rtems/score/threadimpl.h> |
---|
24 | |
---|
25 | void _API_Mutex_Lock( API_Mutex_Control *the_mutex ) |
---|
26 | { |
---|
27 | Thread_Life_state previous_thread_life_state; |
---|
28 | |
---|
29 | previous_thread_life_state = |
---|
30 | _Thread_Set_life_protection( THREAD_LIFE_PROTECTED ); |
---|
31 | |
---|
32 | _Mutex_recursive_Acquire( &the_mutex->Mutex ); |
---|
33 | |
---|
34 | if ( the_mutex->Mutex._nest_level == 0 ) { |
---|
35 | the_mutex->previous_thread_life_state = previous_thread_life_state; |
---|
36 | } |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.