summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/statesimpl.h2
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h18
-rw-r--r--cpukit/score/src/mpci.c6
-rw-r--r--cpukit/score/src/threadstart.c27
4 files changed, 26 insertions, 27 deletions
diff --git a/cpukit/score/include/rtems/score/statesimpl.h b/cpukit/score/include/rtems/score/statesimpl.h
index 54052e2b74..596246c422 100644
--- a/cpukit/score/include/rtems/score/statesimpl.h
+++ b/cpukit/score/include/rtems/score/statesimpl.h
@@ -123,7 +123,7 @@ extern "C" {
STATES_WAITING_FOR_SYSTEM_EVENT | \
STATES_INTERRUPTIBLE_BY_SIGNAL )
-/** All state bits set to one (provided for _Thread_Ready()) */
+/** All state bits set to one (provided for _Thread_Start()) */
#define STATES_ALL_SET 0xffffffff
/**
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index cdd7f9b300..6f97ca9866 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -187,7 +187,8 @@ bool _Thread_Initialize(
*/
bool _Thread_Start(
Thread_Control *the_thread,
- const Thread_Entry_information *entry
+ const Thread_Entry_information *entry,
+ ISR_lock_Context *lock_context
);
void _Thread_Restart_self(
@@ -288,21 +289,6 @@ States_Control _Thread_Set_state(
);
/**
- * @brief Clears all thread states.
- *
- * In case the previous state is a non-ready state, then the thread is
- * unblocked by the scheduler.
- *
- * @param[in] the_thread The thread.
- */
-RTEMS_INLINE_ROUTINE void _Thread_Ready(
- Thread_Control *the_thread
-)
-{
- _Thread_Clear_state( the_thread, STATES_ALL_SET );
-}
-
-/**
* @brief Initializes enviroment for a thread.
*
* This routine initializes the context of @a the_thread to its
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 57eb5f3991..8eec2782c0 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -134,7 +134,8 @@ static void _MPCI_Create_server( void )
}
}
};
- Objects_Name name;
+ ISR_lock_Context lock_context;
+ Objects_Name name;
if ( !_System_state_Is_multiprocessing )
@@ -164,7 +165,8 @@ static void _MPCI_Create_server( void )
name
);
- _Thread_Start( _MPCI_Receive_server_tcb, &entry );
+ _ISR_lock_ISR_disable( &lock_context );
+ _Thread_Start( _MPCI_Receive_server_tcb, &entry, &lock_context );
}
static void _MPCI_Initialization( void )
diff --git a/cpukit/score/src/threadstart.c b/cpukit/score/src/threadstart.c
index 0cdf2bc85a..676e34da49 100644
--- a/cpukit/score/src/threadstart.c
+++ b/cpukit/score/src/threadstart.c
@@ -25,17 +25,28 @@
bool _Thread_Start(
Thread_Control *the_thread,
- const Thread_Entry_information *entry
+ const Thread_Entry_information *entry,
+ ISR_lock_Context *lock_context
)
{
- if ( _States_Is_dormant( the_thread->current_state ) ) {
- the_thread->Start.Entry = *entry;
- _Thread_Load_environment( the_thread );
- _Thread_Ready( the_thread );
- _User_extensions_Thread_start( the_thread );
+ Per_CPU_Control *cpu_self;
- return true;
+ _Thread_State_acquire_critical( the_thread, lock_context );
+
+ if ( !_States_Is_dormant( the_thread->current_state ) ) {
+ _Thread_State_release( the_thread, lock_context );
+ return false;
}
- return false;
+ the_thread->Start.Entry = *entry;
+ _Thread_Load_environment( the_thread );
+ _Thread_Clear_state_locked( the_thread, STATES_ALL_SET );
+
+ cpu_self = _Thread_Dispatch_disable_critical( lock_context );
+ _Thread_State_release( the_thread, lock_context );
+
+ _User_extensions_Thread_start( the_thread );
+
+ _Thread_Dispatch_enable( cpu_self );
+ return true;
}