4.115
Last change
on this file since 69aa3349 was
69aa3349,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/08/14 at 07:42:29
|
score: Simplify thread control initialization
The thread control block contains fields that point to application
configuration dependent memory areas, like the scheduler information,
the API control blocks, the user extension context table, the RTEMS
notepads and the Newlib re-entrancy support. Account for these areas in
the configuration and avoid extra workspace allocations for these areas.
This helps also to avoid heap fragementation and reduces the per thread
memory due to a reduced heap allocation overhead.
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Newlib Support |
---|
5 | * @ingroup libcsupport |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1994 by Division Incorporated |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.org/license/LICENSE. |
---|
14 | * |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems.h> |
---|
22 | |
---|
23 | #if defined(RTEMS_NEWLIB) |
---|
24 | |
---|
25 | #include <sys/reent.h> |
---|
26 | #include <stdlib.h> |
---|
27 | #include <string.h> |
---|
28 | |
---|
29 | #include <rtems/libcsupport.h> |
---|
30 | #include <rtems/score/threadimpl.h> |
---|
31 | #include <rtems/score/wkspace.h> |
---|
32 | |
---|
33 | bool newlib_create_hook( |
---|
34 | rtems_tcb *current_task __attribute__((unused)), |
---|
35 | rtems_tcb *creating_task |
---|
36 | ) |
---|
37 | { |
---|
38 | #if !defined(__DYNAMIC_REENT__) |
---|
39 | if (_Thread_libc_reent == 0) |
---|
40 | { |
---|
41 | _REENT = _GLOBAL_REENT; |
---|
42 | |
---|
43 | _Thread_Set_libc_reent (&_REENT); |
---|
44 | } |
---|
45 | #endif |
---|
46 | |
---|
47 | _REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */ |
---|
48 | |
---|
49 | return true; |
---|
50 | } |
---|
51 | |
---|
52 | void newlib_terminate_hook( |
---|
53 | rtems_tcb *current_task |
---|
54 | ) |
---|
55 | { |
---|
56 | _reclaim_reent(current_task->libc_reent); |
---|
57 | } |
---|
58 | |
---|
59 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.