From 69aa33490b1cd357519ab70b15ad150e11bb752e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 8 Apr 2014 09:42:29 +0200 Subject: 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. --- cpukit/score/src/schedulercbsallocate.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'cpukit/score/src/schedulercbsallocate.c') diff --git a/cpukit/score/src/schedulercbsallocate.c b/cpukit/score/src/schedulercbsallocate.c index 1190b84254..a6f89c35a9 100644 --- a/cpukit/score/src/schedulercbsallocate.c +++ b/cpukit/score/src/schedulercbsallocate.c @@ -25,24 +25,18 @@ #include #include -void *_Scheduler_CBS_Allocate( +bool _Scheduler_CBS_Allocate( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread ) { - void *sched; - Scheduler_CBS_Per_thread *schinfo; + Scheduler_CBS_Per_thread *schinfo = the_thread->scheduler_info; (void) scheduler; - sched = _Workspace_Allocate(sizeof(Scheduler_CBS_Per_thread)); - if ( sched ) { - the_thread->scheduler_info = sched; - schinfo = (Scheduler_CBS_Per_thread *)(the_thread->scheduler_info); - schinfo->edf_per_thread.thread = the_thread; - schinfo->edf_per_thread.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN; - schinfo->cbs_server = NULL; - } + schinfo->edf_per_thread.thread = the_thread; + schinfo->edf_per_thread.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN; + schinfo->cbs_server = NULL; - return sched; + return true; } -- cgit v1.2.3