5
Last change
on this file since 2548d14 was
709f38a,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/13/16 at 04:48:58
|
score: Use chain iterator for user extensions
Add a lock and use a chain iterator for safe iteration during concurrent
user extension addition and removal.
Ensure that dynamically added thread delete and fatal extensions are
called in reverse order.
Update #2555.
Update #2692.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreUserExt |
---|
5 | * |
---|
6 | * @brief User Extension Handler implementation. |
---|
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/userextimpl.h> |
---|
23 | #include <rtems/score/percpu.h> |
---|
24 | |
---|
25 | void _User_extensions_Remove_set ( |
---|
26 | User_extensions_Control *the_extension |
---|
27 | ) |
---|
28 | { |
---|
29 | ISR_lock_Context lock_context; |
---|
30 | |
---|
31 | _User_extensions_Acquire( &lock_context ); |
---|
32 | _Chain_Iterator_registry_update( |
---|
33 | &_User_extensions_List.Iterators, |
---|
34 | &the_extension->Node |
---|
35 | ); |
---|
36 | _Chain_Extract_unprotected( &the_extension->Node ); |
---|
37 | _User_extensions_Release( &lock_context ); |
---|
38 | |
---|
39 | /* |
---|
40 | * If a switch handler is present, remove it. |
---|
41 | */ |
---|
42 | |
---|
43 | if ( the_extension->Callouts.thread_switch != NULL ) { |
---|
44 | ISR_Level level; |
---|
45 | |
---|
46 | _Per_CPU_Acquire_all( level ); |
---|
47 | _Chain_Extract_unprotected( &the_extension->Switch.Node ); |
---|
48 | _Per_CPU_Release_all( level ); |
---|
49 | } |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.