summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/tasks.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-08 09:42:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-15 08:37:12 +0200
commit69aa33490b1cd357519ab70b15ad150e11bb752e (patch)
tree8aa1ac3807bfe65ae1157629d0ad21548c35a5cb /cpukit/rtems/src/tasks.c
parentscore: Static scheduler configuration (diff)
downloadrtems-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 '')
-rw-r--r--cpukit/rtems/src/tasks.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index 209a43cb07..f989fff580 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -50,23 +50,9 @@ static bool _RTEMS_tasks_Create_extension(
)
{
RTEMS_API_Control *api;
- int i;
- size_t to_allocate;
+ size_t i;
- /*
- * Notepads must be the last entry in the structure and they
- * can be left off if disabled in the configuration.
- */
- to_allocate = sizeof( RTEMS_API_Control );
- if ( !rtems_configuration_get_notepads_enabled() )
- to_allocate -= (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t));
-
- api = _Workspace_Allocate( to_allocate );
-
- if ( !api )
- return false;
-
- created->API_Extensions[ THREAD_API_RTEMS ] = api;
+ api = created->API_Extensions[ THREAD_API_RTEMS ];
_Event_Initialize( &api->Event );
_Event_Initialize( &api->System_event );
@@ -104,24 +90,6 @@ static void _RTEMS_tasks_Start_extension(
_Event_Initialize( &api->System_event );
}
-/*
- * _RTEMS_tasks_Delete_extension
- *
- * This extension routine is invoked when a task is deleted.
- */
-
-static void _RTEMS_tasks_Delete_extension(
- Thread_Control *executing,
- Thread_Control *deleted
-)
-{
- /*
- * Free API specific memory
- */
-
- (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] );
-}
-
static void _RTEMS_tasks_Terminate_extension(
Thread_Control *executing
)
@@ -204,7 +172,7 @@ User_extensions_Control _RTEMS_tasks_User_extensions = {
{ _RTEMS_tasks_Create_extension, /* create */
_RTEMS_tasks_Start_extension, /* start */
_RTEMS_tasks_Start_extension, /* restart */
- _RTEMS_tasks_Delete_extension, /* delete */
+ NULL, /* delete */
RTEMS_TASKS_SWITCH_EXTENSION, /* switch */
NULL, /* begin */
NULL, /* exitted */
@@ -221,7 +189,7 @@ void _RTEMS_tasks_Manager_initialization(void)
OBJECTS_RTEMS_TASKS, /* object class */
Configuration_RTEMS_API.maximum_tasks,
/* maximum objects of this class */
- sizeof( Thread_Control ), /* size of this object's control block */
+ _Thread_Control_size, /* size of this object's control block */
false, /* true if the name is a string */
RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
#if defined(RTEMS_MULTIPROCESSING)