Changeset b9083c55 in rtems


Ignore:
Timestamp:
May 14, 2021, 12:53:19 PM (2 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
73ebf9a
Parents:
57be57c7
git-author:
Sebastian Huber <sebastian.huber@…> (05/14/21 12:53:19)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/14/21 12:56:29)
Message:

rtems: Always set the real priority during restart

Unconditionally set the real priority of the task to its initial
priority during a task restart.

Close #4411.

File:
1 edited

Legend:

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

    r57be57c7 rb9083c55  
    376376}
    377377
    378 static void _Thread_Finalize_life_change(
    379   Thread_Control   *the_thread,
    380   Priority_Control  priority
    381 )
    382 {
    383   _Thread_queue_Extract_with_proxy( the_thread );
    384   _Thread_Timer_remove( the_thread );
    385   _Thread_Raise_real_priority( the_thread, priority );
    386   _Thread_Remove_life_change_request( the_thread );
    387 }
    388 
    389378void _Thread_Join(
    390379  Thread_Control       *the_thread,
     
    425414  Thread_Life_state  previous;
    426415  Per_CPU_Control   *cpu_self;
    427   Priority_Control   priority;
    428416
    429417  _Assert( the_thread != executing );
     
    440428
    441429  cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
    442   priority = _Thread_Get_priority( executing );
    443430
    444431  if ( _States_Is_dormant( the_thread->current_state ) ) {
    445432    _Thread_State_release( the_thread, &lock_context );
    446433    _Thread_Make_zombie( the_thread );
    447   } else if ( _Thread_Is_life_change_allowed( previous ) ) {
     434  } else {
     435    Priority_Control priority;
     436
    448437    _Thread_Add_life_change_request( the_thread );
    449     _Thread_State_release( the_thread, &lock_context );
    450 
    451     _Thread_Finalize_life_change( the_thread, priority );
    452   } else {
    453     _Thread_Add_life_change_request( the_thread );
    454     _Thread_Clear_state_locked( the_thread, STATES_SUSPENDED );
    455     _Thread_State_release( the_thread, &lock_context );
    456 
     438
     439    if ( _Thread_Is_life_change_allowed( previous ) ) {
     440      _Thread_State_release( the_thread, &lock_context );
     441
     442      _Thread_queue_Extract_with_proxy( the_thread );
     443      _Thread_Timer_remove( the_thread );
     444    } else {
     445      _Thread_Clear_state_locked( the_thread, STATES_SUSPENDED );
     446      _Thread_State_release( the_thread, &lock_context );
     447    }
     448
     449    priority = _Thread_Get_priority( executing );
    457450    _Thread_Raise_real_priority( the_thread, priority );
    458451    _Thread_Remove_life_change_request( the_thread );
     
    531524)
    532525{
    533   Thread_Life_state  previous;
    534   Per_CPU_Control   *cpu_self;
     526  Thread_Life_state    previous;
     527  Per_CPU_Control     *cpu_self;
     528  Thread_queue_Context queue_context;
    535529
    536530  _Thread_State_acquire_critical( the_thread, lock_context );
     
    555549    _Thread_State_release( the_thread, lock_context );
    556550
    557     _Thread_Finalize_life_change(
    558       the_thread,
    559       the_thread->Start.initial_priority
    560     );
     551    _Thread_queue_Extract_with_proxy( the_thread );
     552    _Thread_Timer_remove( the_thread );
     553    _Thread_Remove_life_change_request( the_thread );
    561554  } else {
    562555    _Thread_Clear_state_locked( the_thread, STATES_SUSPENDED );
     
    564557  }
    565558
     559  _Thread_queue_Context_initialize( &queue_context );
     560  _Thread_queue_Context_clear_priority_updates( &queue_context );
     561  _Thread_Wait_acquire( the_thread, &queue_context );
     562  _Thread_Priority_change(
     563    the_thread,
     564    &the_thread->Real_priority,
     565    the_thread->Start.initial_priority,
     566    false,
     567    &queue_context
     568  );
     569  _Thread_Wait_release( the_thread, &queue_context );
     570
     571  _Thread_Priority_update( &queue_context );
    566572  _Thread_Dispatch_enable( cpu_self );
    567573  return STATUS_SUCCESSFUL;
Note: See TracChangeset for help on using the changeset viewer.