diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-29 09:43:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-10 10:38:45 +0200 |
commit | 709796209c88e6749320b3096df57f369c2d62be (patch) | |
tree | 072e7cd5cef37aad7404a02344724a4348602f35 /cpukit/include/rtems/score/schedulerimpl.h | |
parent | score: Modify _Scheduler_Unblock() (diff) | |
download | rtems-709796209c88e6749320b3096df57f369c2d62be.tar.bz2 |
score: Add thread pin/unpin support
Add support to temporarily pin a thread to its current processor. This
may be used to access per-processor data structures in critical sections
with enabled thread dispatching, e.g. a pinned thread is allowed to
block.
Update #3508.
Diffstat (limited to 'cpukit/include/rtems/score/schedulerimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/schedulerimpl.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h index 2fe30b3d6b..fda043ea5a 100644 --- a/cpukit/include/rtems/score/schedulerimpl.h +++ b/cpukit/include/rtems/score/schedulerimpl.h @@ -1095,17 +1095,13 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set( &the_thread->Real_priority ); - if ( !_Priority_Is_empty( &old_scheduler_node->Wait.Priority ) ) { - _Priority_Plain_insert( - &old_scheduler_node->Wait.Priority, - &the_thread->Real_priority, - the_thread->Real_priority.priority - ); - return STATUS_RESOURCE_IN_USE; - } - + if ( + !_Priority_Is_empty( &old_scheduler_node->Wait.Priority ) #if defined(RTEMS_SMP) - if ( !_Chain_Has_only_one_node( &the_thread->Scheduler.Wait_nodes ) ) { + || !_Chain_Has_only_one_node( &the_thread->Scheduler.Wait_nodes ) + || the_thread->Scheduler.pin_level != 0 +#endif + ) { _Priority_Plain_insert( &old_scheduler_node->Wait.Priority, &the_thread->Real_priority, @@ -1114,6 +1110,7 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set( return STATUS_RESOURCE_IN_USE; } +#if defined(RTEMS_SMP) old_scheduler = _Thread_Scheduler_get_home( the_thread ); new_scheduler_node = _Thread_Scheduler_get_node_by_index( the_thread, @@ -1140,7 +1137,8 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set( return STATUS_UNSATISFIED; } - the_thread->Scheduler.home = new_scheduler; + _Assert( the_thread->Scheduler.pinned_scheduler == NULL ); + the_thread->Scheduler.home_scheduler = new_scheduler; _Scheduler_Release_critical( new_scheduler, &lock_context ); |