4.115
Last change
on this file since 25f5730f was
34684573,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 12:38:04
|
score: Use thread life protection for API mutexes
This prevents that asynchronous thread deletion can lead to an unusable
allocator or once mutex.
|
-
Property mode set to
100644
|
File size:
1008 bytes
|
Rev | Line | |
---|
[f839bf5a] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @brief Releases the Specified API Mutex |
---|
| 5 | * |
---|
| 6 | * @ingroup ScoreAPIMutex |
---|
| 7 | */ |
---|
| 8 | |
---|
[8fd28d83] | 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 |
---|
[c499856] | 15 | * http://www.rtems.org/license/LICENSE. |
---|
[8fd28d83] | 16 | */ |
---|
| 17 | |
---|
| 18 | #if HAVE_CONFIG_H |
---|
| 19 | #include "config.h" |
---|
| 20 | #endif |
---|
| 21 | |
---|
| 22 | #include <rtems/score/apimutex.h> |
---|
[1e4f08b4] | 23 | #include <rtems/score/coremuteximpl.h> |
---|
[8fd28d83] | 24 | |
---|
[34684573] | 25 | void _API_Mutex_Unlock( API_Mutex_Control *the_mutex ) |
---|
[8fd28d83] | 26 | { |
---|
[34684573] | 27 | bool previous_thread_life_protection; |
---|
| 28 | bool restore_thread_life_protection; |
---|
| 29 | |
---|
| 30 | _Thread_Disable_dispatch(); |
---|
| 31 | |
---|
| 32 | previous_thread_life_protection = |
---|
| 33 | the_mutex->previous_thread_life_protection; |
---|
| 34 | restore_thread_life_protection = the_mutex->Mutex.nest_count == 1; |
---|
| 35 | |
---|
| 36 | _CORE_mutex_Surrender( &the_mutex->Mutex, the_mutex->Object.id, NULL ); |
---|
| 37 | |
---|
[17b73dc] | 38 | _Thread_Enable_dispatch(); |
---|
[34684573] | 39 | |
---|
| 40 | if ( restore_thread_life_protection ) { |
---|
| 41 | _Thread_Set_life_protection( previous_thread_life_protection ); |
---|
| 42 | } |
---|
[8fd28d83] | 43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.