diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-08 09:42:29 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-15 08:37:12 +0200 |
commit | 69aa33490b1cd357519ab70b15ad150e11bb752e (patch) | |
tree | 8aa1ac3807bfe65ae1157629d0ad21548c35a5cb /cpukit/libcsupport/src/newlibc_reent.c | |
parent | score: Static scheduler configuration (diff) | |
download | rtems-69aa33490b1cd357519ab70b15ad150e11bb752e.tar.bz2 |
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.
Diffstat (limited to 'cpukit/libcsupport/src/newlibc_reent.c')
-rw-r--r-- | cpukit/libcsupport/src/newlibc_reent.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c index cd3ac2a0ec..430157cf0f 100644 --- a/cpukit/libcsupport/src/newlibc_reent.c +++ b/cpukit/libcsupport/src/newlibc_reent.c @@ -35,9 +35,6 @@ bool newlib_create_hook( rtems_tcb *creating_task ) { - struct _reent *ptr; - bool ok; - #if !defined(__DYNAMIC_REENT__) if (_Thread_libc_reent == 0) { @@ -47,28 +44,9 @@ bool newlib_create_hook( } #endif - /* It is OK to allocate from the workspace because these - * hooks run with thread dispatching disabled. - */ - ptr = (struct _reent *) _Workspace_Allocate(sizeof(*ptr)); - creating_task->libc_reent = ptr; - ok = ptr != NULL; - - if (ok) { - _REENT_INIT_PTR((ptr)); /* GCC extension: structure constants */ - } - - return ok; -} - -void newlib_delete_hook( - rtems_tcb *current_task, - rtems_tcb *deleted_task -) -{ - (void) current_task; + _REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */ - _Workspace_Free(deleted_task->libc_reent); + return true; } void newlib_terminate_hook( |