summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulercbsallocate.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/score/src/schedulercbsallocate.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 'cpukit/score/src/schedulercbsallocate.c')
-rw-r--r--cpukit/score/src/schedulercbsallocate.c20
1 files changed, 7 insertions, 13 deletions
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 <rtems/score/schedulercbs.h>
#include <rtems/score/wkspace.h>
-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;
}