4.115
Last change
on this file since a4203273 was
23fec9f0,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 13:16:12
|
score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicUserExtensions |
---|
5 | * |
---|
6 | * @brief User Extensions 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/system.h> |
---|
23 | #include <rtems/rtems/support.h> |
---|
24 | #include <rtems/score/thread.h> |
---|
25 | #include <rtems/score/userextimpl.h> |
---|
26 | #include <rtems/extensionimpl.h> |
---|
27 | |
---|
28 | rtems_status_code rtems_extension_create( |
---|
29 | rtems_name name, |
---|
30 | const rtems_extensions_table *extension_table, |
---|
31 | rtems_id *id |
---|
32 | ) |
---|
33 | { |
---|
34 | Extension_Control *the_extension; |
---|
35 | |
---|
36 | if ( !id ) |
---|
37 | return RTEMS_INVALID_ADDRESS; |
---|
38 | |
---|
39 | if ( !rtems_is_name_valid( name ) ) |
---|
40 | return RTEMS_INVALID_NAME; |
---|
41 | |
---|
42 | the_extension = _Extension_Allocate(); |
---|
43 | |
---|
44 | if ( !the_extension ) { |
---|
45 | _Objects_Allocator_unlock(); |
---|
46 | return RTEMS_TOO_MANY; |
---|
47 | } |
---|
48 | |
---|
49 | _Thread_Disable_dispatch(); |
---|
50 | _User_extensions_Add_set_with_table( &the_extension->Extension, extension_table ); |
---|
51 | _Thread_Enable_dispatch(); |
---|
52 | |
---|
53 | _Objects_Open( |
---|
54 | &_Extension_Information, |
---|
55 | &the_extension->Object, |
---|
56 | (Objects_Name) name |
---|
57 | ); |
---|
58 | |
---|
59 | *id = the_extension->Object.id; |
---|
60 | _Objects_Allocator_unlock(); |
---|
61 | return RTEMS_SUCCESSFUL; |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.