[PATCH v1 1/3] priorityaffinitysmp: Update block state check
Ryan Long
ryan.long at oarcorp.com
Wed Nov 17 15:33:51 UTC 2021
The thread's blocked status is recorded in the thread's scheduler state,
not directly in the thread state. This prevents blocking from being
nested which violates asserts and eventually causes a crash.
---
cpukit/score/src/schedulerpriorityaffinitysmp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 10f6808..2bad6ff 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -550,7 +550,7 @@ Status_Control _Scheduler_priority_affinity_SMP_Set_affinity(
{
Scheduler_Context *context;
Scheduler_priority_affinity_SMP_Node *node;
- States_Control current_state;
+ Thread_Scheduler_state current_state;
Processor_mask my_affinity;
context = _Scheduler_Get_context( scheduler );
@@ -569,15 +569,15 @@ Status_Control _Scheduler_priority_affinity_SMP_Set_affinity(
if ( _Processor_mask_Is_equal( &node->Affinity, affinity ) )
return STATUS_SUCCESSFUL;
- current_state = thread->current_state;
+ current_state = thread->Scheduler.state;
- if ( _States_Is_ready( current_state ) ) {
+ if ( current_state == THREAD_SCHEDULER_READY ) {
_Scheduler_priority_affinity_SMP_Block( scheduler, thread, &node->Base.Base.Base );
}
_Processor_mask_Assign( &node->Affinity, affinity );
- if ( _States_Is_ready( current_state ) ) {
+ if ( current_state == THREAD_SCHEDULER_READY ) {
/*
* FIXME: Do not ignore threads in need for help.
*/
--
1.8.3.1
More information about the devel
mailing list