diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-13 14:07:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 07:49:39 +0200 |
commit | 33829ce155069462ba410d396da431386369ed08 (patch) | |
tree | bd4d700e4a567280c6b2aa3e8f43c3997d20d9e7 /cpukit/score/src | |
parent | posix: Rework pthread_join() (diff) | |
download | rtems-33829ce155069462ba410d396da431386369ed08.tar.bz2 |
score: Avoid Giant lock for _Thread_Start()
Update #2555.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/mpci.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/threadstart.c | 27 |
2 files changed, 23 insertions, 10 deletions
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; } |