source:
rtems/cpukit/score/src/apimutexlock.c
@
23fec9f0
Last change on this file since 23fec9f0 was 34684573, checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 12:38:04 | |
---|---|
|
|
File size: 1.1 KB |
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/coremuteximpl.h> |
24 | #include <rtems/score/threadimpl.h> |
25 | |
26 | void _API_Mutex_Lock( API_Mutex_Control *the_mutex ) |
27 | { |
28 | bool previous_thread_life_protection; |
29 | ISR_Level level; |
30 | |
31 | previous_thread_life_protection = _Thread_Set_life_protection( true ); |
32 | |
33 | #if defined(RTEMS_SMP) |
34 | _Thread_Disable_dispatch(); |
35 | #endif |
36 | |
37 | _ISR_Disable( level ); |
38 | |
39 | _CORE_mutex_Seize( |
40 | &the_mutex->Mutex, |
41 | _Thread_Executing, |
42 | the_mutex->Object.id, |
43 | true, |
44 | 0, |
45 | level |
46 | ); |
47 | |
48 | if ( the_mutex->Mutex.nest_count == 1 ) { |
49 | the_mutex->previous_thread_life_protection = |
50 | previous_thread_life_protection; |
51 | } |
52 | |
53 | #if defined(RTEMS_SMP) |
54 | _Thread_Enable_dispatch(); |
55 | #endif |
56 | } |
Note: See TracBrowser
for help on using the repository browser.