score: Simplify _Thread_Start()

This commit is contained in:
Sebastian Huber
2016-01-11 08:47:24 +01:00
parent ccd54344d9
commit 1506658c07
5 changed files with 25 additions and 33 deletions
+1 -1
View File
@@ -228,7 +228,7 @@ int pthread_create(
/*
* POSIX threads are allocated and started in one operation.
*/
status = _Thread_Start( the_thread, &entry, NULL );
status = _Thread_Start( the_thread, &entry );
#if defined(RTEMS_DEBUG)
/*
+1 -1
View File
@@ -64,7 +64,7 @@ rtems_status_code rtems_task_start(
switch ( location ) {
case OBJECTS_LOCAL:
successfully_started = _Thread_Start( the_thread, &entry, NULL );
successfully_started = _Thread_Start( the_thread, &entry );
_Objects_Put( &the_thread->Object );
@@ -187,14 +187,10 @@ bool _Thread_Initialize(
*
* @param the_thread The thread to be started.
* @param entry The thread entry information.
* @param[in,out] cpu The processor if used to start an idle thread
* during system initialization. Must be set to @c NULL to start a normal
* thread.
*/
bool _Thread_Start(
Thread_Control *the_thread,
const Thread_Entry_information *entry,
Per_CPU_Control *cpu
const Thread_Entry_information *entry
);
bool _Thread_Restart(
+20 -11
View File
@@ -21,20 +21,14 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/stackimpl.h>
#include <rtems/score/userextimpl.h>
#include <rtems/config.h>
static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )
{
Thread_Entry_information entry = {
.adaptor = _Thread_Entry_adaptor_idle,
.Kinds = {
.Idle = {
.entry = rtems_configuration_get_idle_task()
}
}
};
Objects_Name name;
Thread_Control *idle;
Objects_Name name;
Thread_Control *idle;
const Scheduler_Control *scheduler;
name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );
@@ -67,7 +61,22 @@ static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )
cpu->heir =
cpu->executing = idle;
_Thread_Start( idle, &entry, cpu );
idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle;
idle->Start.Entry.Kinds.Idle.entry = rtems_configuration_get_idle_task();
_Thread_Load_environment( idle );
scheduler = _Scheduler_Get_by_CPU( cpu );
#if defined(RTEMS_SMP)
if (scheduler == NULL) {
return;
}
#endif
idle->current_state = STATES_READY;
_Scheduler_Start_idle( scheduler, idle, cpu );
_User_extensions_Thread_start( idle );
}
void _Thread_Create_idle( void )
+2 -15
View File
@@ -21,30 +21,17 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/isrlevel.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/userextimpl.h>
bool _Thread_Start(
Thread_Control *the_thread,
const Thread_Entry_information *entry,
Per_CPU_Control *cpu
const Thread_Entry_information *entry
)
{
if ( _States_Is_dormant( the_thread->current_state ) ) {
the_thread->Start.Entry = *entry;
_Thread_Load_environment( the_thread );
if ( cpu == NULL ) {
_Thread_Ready( the_thread );
} else {
const Scheduler_Control *scheduler = _Scheduler_Get_by_CPU( cpu );
if ( scheduler != NULL ) {
the_thread->current_state = STATES_READY;
_Scheduler_Start_idle( scheduler, the_thread, cpu );
}
}
_Thread_Ready( the_thread );
_User_extensions_Thread_start( the_thread );
return true;