Changeset 6c3976e2 in rtems


Ignore:
Timestamp:
Oct 18, 2021, 11:14:44 AM (3 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
75c133bd
Parents:
940b9b1
git-author:
Sebastian Huber <sebastian.huber@…> (10/18/21 11:14:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/25/21 07:24:52)
Message:

score: Move code block to separate function

Move a code block to the new function _Thread_Scheduler_withdraw_nodes()
to ease code review.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threadscheduler.c

    r940b9b1 r6c3976e2  
    3030
    3131#if defined(RTEMS_SMP)
     32static void _Thread_Scheduler_withdraw_nodes(
     33  Thread_Control *the_thread,
     34  Scheduler_Node *scheduler_node
     35)
     36{
     37  while ( scheduler_node != NULL ) {
     38    Scheduler_Node          *next;
     39    const Scheduler_Control *scheduler;
     40    ISR_lock_Context         lock_context;
     41
     42    next = scheduler_node->Thread.Scheduler_node.next;
     43#if defined(RTEMS_DEBUG)
     44    scheduler_node->Thread.Scheduler_node.next = NULL;
     45#endif
     46
     47    scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
     48
     49    _Scheduler_Acquire_critical( scheduler, &lock_context );
     50    ( *scheduler->Operations.withdraw_node )(
     51      scheduler,
     52      the_thread,
     53      scheduler_node,
     54      THREAD_SCHEDULER_READY
     55    );
     56    _Scheduler_Release_critical( scheduler, &lock_context );
     57
     58    scheduler_node = next;
     59  }
     60}
     61
    3262void _Thread_Scheduler_process_requests( Thread_Control *the_thread )
    3363{
     
    4070
    4171  if ( scheduler_node != NULL ) {
    42     Scheduler_Node *next;
    4372    Scheduler_Node *remove;
    4473
     
    4877    do {
    4978      Scheduler_Node_request request;
     79      Scheduler_Node        *next;
    5080
    5181      request = scheduler_node->Thread.request;
     
    78108
    79109    _Thread_Scheduler_release_critical( the_thread, &lock_context );
    80 
    81     scheduler_node = remove;
    82 
    83     while ( scheduler_node != NULL ) {
    84       const Scheduler_Control *scheduler;
    85       ISR_lock_Context         lock_context;
    86 
    87       next = scheduler_node->Thread.Scheduler_node.next;
    88 #if defined(RTEMS_DEBUG)
    89       scheduler_node->Thread.Scheduler_node.next = NULL;
    90 #endif
    91 
    92       scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
    93 
    94       _Scheduler_Acquire_critical( scheduler, &lock_context );
    95       ( *scheduler->Operations.withdraw_node )(
    96         scheduler,
    97         the_thread,
    98         scheduler_node,
    99         THREAD_SCHEDULER_READY
    100       );
    101       _Scheduler_Release_critical( scheduler, &lock_context );
    102 
    103       scheduler_node = next;
    104     }
     110    _Thread_Scheduler_withdraw_nodes( the_thread, remove );
    105111  } else {
    106112    _Thread_Scheduler_release_critical( the_thread, &lock_context );
Note: See TracChangeset for help on using the changeset viewer.