score: Fix _Scheduler_Try_to_schedule_node() usage

Fix wrong use of continue statement in while loops.
This commit is contained in:
Sebastian Huber
2016-09-30 10:10:22 +02:00
parent fac8a3a463
commit d057d6537f

View File

@@ -714,10 +714,11 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
Scheduler_SMP_Allocate_processor allocate_processor
)
{
Thread_Control *needs_help;
while ( true ) {
Scheduler_Node *highest_ready;
Scheduler_Try_to_schedule_action action;
do {
Scheduler_Node *highest_ready = ( *get_highest_ready )( context, node );
highest_ready = ( *get_highest_ready )( context, node );
/*
* The node has been extracted from the scheduled chain. We have to place
@@ -725,10 +726,8 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
*/
if ( ( *order )( &node->Node, &highest_ready->Node ) ) {
( *insert_scheduled )( context, node );
needs_help = NULL;
} else {
Scheduler_Try_to_schedule_action action;
return NULL;
}
action = _Scheduler_Try_to_schedule_node(
context,
@@ -762,10 +761,11 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
node,
_Scheduler_SMP_Release_idle_thread
);
if ( idle == NULL ) {
needs_help = user;
return user;
} else {
needs_help = NULL;
return NULL;
}
} else if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE ) {
_Scheduler_SMP_Node_change_state(
@@ -785,8 +785,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
node,
_Scheduler_Node_get_idle( node )
);
needs_help = NULL;
return NULL;
} else {
_Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
@@ -796,13 +795,8 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
);
( *extract_from_ready )( context, highest_ready );
continue;
}
}
} while ( false );
return needs_help;
}
static inline void _Scheduler_SMP_Extract_from_scheduled(
@@ -821,9 +815,10 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
Scheduler_SMP_Allocate_processor allocate_processor
)
{
Scheduler_Try_to_schedule_action action;
do {
Scheduler_Node *highest_ready = ( *get_highest_ready )( context, victim );
Scheduler_Try_to_schedule_action action;
action = _Scheduler_Try_to_schedule_node(
context,
@@ -850,10 +845,8 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
);
( *extract_from_ready )( context, highest_ready );
continue;
}
} while ( false );
} while ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
}
/**