summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
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/posix
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 'cpukit/posix')
-rw-r--r--cpukit/posix/src/pthread.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 6f79658677..ab197f3a51 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -190,12 +190,7 @@ static bool _POSIX_Threads_Create_extension(
POSIX_API_Control *api;
POSIX_API_Control *executing_api;
- api = _Workspace_Allocate( sizeof( POSIX_API_Control ) );
-
- if ( !api )
- return false;
-
- created->API_Extensions[ THREAD_API_POSIX ] = api;
+ api = created->API_Extensions[ THREAD_API_POSIX ];
/* XXX check all fields are touched */
_POSIX_Threads_Initialize_attributes( &api->Attributes );
@@ -266,19 +261,6 @@ static void _POSIX_Threads_Restart_extension(
_POSIX_Threads_cancel_run( restarted );
}
-/*
- * _POSIX_Threads_Delete_extension
- *
- * This method is invoked for each thread deleted.
- */
-static void _POSIX_Threads_Delete_extension(
- Thread_Control *executing __attribute__((unused)),
- Thread_Control *deleted
-)
-{
- _Workspace_Free( deleted->API_Extensions[ THREAD_API_POSIX ] );
-}
-
static void _POSIX_Threads_Terminate_extension(
Thread_Control *executing
)
@@ -355,7 +337,7 @@ User_extensions_Control _POSIX_Threads_User_extensions = {
{ _POSIX_Threads_Create_extension, /* create */
NULL, /* start */
_POSIX_Threads_Restart_extension, /* restart */
- _POSIX_Threads_Delete_extension, /* delete */
+ NULL, /* delete */
NULL, /* switch */
NULL, /* begin */
_POSIX_Threads_Exitted_extension, /* exitted */
@@ -392,8 +374,7 @@ void _POSIX_Threads_Manager_initialization(void)
OBJECTS_POSIX_THREADS, /* object class */
Configuration_POSIX_API.maximum_threads,
/* 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 */
true, /* true if names for this object are strings */
_POSIX_PATH_MAX /* maximum length of each object's name */
#if defined(RTEMS_MULTIPROCESSING)