summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/schedulersmpimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-29 09:43:44 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-10 10:38:45 +0200
commit709796209c88e6749320b3096df57f369c2d62be (patch)
tree072e7cd5cef37aad7404a02344724a4348602f35 /cpukit/include/rtems/score/schedulersmpimpl.h
parentscore: Modify _Scheduler_Unblock() (diff)
downloadrtems-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/schedulersmpimpl.h')
-rw-r--r--cpukit/include/rtems/score/schedulersmpimpl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h
index 09c95662b6..0abe82b1f0 100644
--- a/cpukit/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/include/rtems/score/schedulersmpimpl.h
@@ -1185,6 +1185,14 @@ static inline bool _Scheduler_SMP_Ask_for_help(
ISR_lock_Context lock_context;
bool success;
+ if ( thread->Scheduler.pinned_scheduler != NULL ) {
+ /*
+ * Pinned threads are not allowed to ask for help. Return success to break
+ * the loop in _Thread_Ask_for_help() early.
+ */
+ return true;
+ }
+
lowest_scheduled = ( *get_lowest_scheduled )( context, node );
_Thread_Scheduler_acquire_critical( thread, &lock_context );
@@ -1474,6 +1482,7 @@ static inline void _Scheduler_SMP_Set_affinity(
( *set_affinity )( context, node, arg );
( *enqueue )( context, node, insert_priority );
} else {
+ _Assert( node_state == SCHEDULER_SMP_NODE_BLOCKED );
( *set_affinity )( context, node, arg );
}
}