Changeset f4d1f30 in rtems


Ignore:
Timestamp:
Jun 22, 2016, 3:09:56 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ac8402dd
Parents:
0b836337
git-author:
Sebastian Huber <sebastian.huber@…> (06/22/16 15:09:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/27/16 08:55:30)
Message:

score: Split _Thread_Change_priority()

Update #2412.
Update #2556.
Update #2765.

Location:
cpukit/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/threadimpl.h

    r0b836337 rf4d1f30  
    460460  void             *arg
    461461);
     462
     463Thread_Control *_Thread_Apply_priority(
     464  Thread_Control                *the_thread,
     465  Priority_Control               new_priority,
     466  void                          *arg,
     467  Thread_Change_priority_filter  filter,
     468  bool                           prepend_it
     469);
     470
     471void _Thread_Update_priority( Thread_Control *the_thread );
    462472
    463473/**
  • cpukit/score/src/threadchangepriority.c

    r0b836337 rf4d1f30  
    2323#include <rtems/score/schedulerimpl.h>
    2424
    25 void _Thread_Change_priority(
     25static Thread_Control *_Thread_Apply_priority_locked(
    2626  Thread_Control                *the_thread,
    2727  Priority_Control               new_priority,
     
    3131)
    3232{
    33   ISR_lock_Context  lock_context;
    34   ISR_lock_Control *lock;
    35 
    36   lock = _Thread_Lock_acquire( the_thread, &lock_context );
    37 
    3833  /*
    3934   * For simplicity set the priority restore hint unconditionally since this is
     
    6358      the_thread->Wait.queue
    6459    );
    65 
    66     _Thread_Lock_release( lock, &lock_context );
     60  } else {
     61    the_thread = NULL;
     62  }
     63
     64  return the_thread;
     65}
     66
     67Thread_Control *_Thread_Apply_priority(
     68  Thread_Control                *the_thread,
     69  Priority_Control               new_priority,
     70  void                          *arg,
     71  Thread_Change_priority_filter  filter,
     72  bool                           prepend_it
     73)
     74{
     75  ISR_lock_Context  lock_context;
     76  ISR_lock_Control *lock;
     77
     78  lock = _Thread_Lock_acquire( the_thread, &lock_context );
     79  the_thread = _Thread_Apply_priority_locked(
     80    the_thread,
     81    new_priority,
     82    arg,
     83    filter,
     84    prepend_it
     85  );
     86  _Thread_Lock_release( lock, &lock_context );
     87  return the_thread;
     88}
     89
     90void _Thread_Update_priority( Thread_Control *the_thread )
     91{
     92  if ( the_thread != NULL ) {
     93    ISR_lock_Context lock_context;
    6794
    6895    _Thread_State_acquire( the_thread, &lock_context );
    6996    _Scheduler_Update_priority( the_thread );
    7097    _Thread_State_release( the_thread, &lock_context );
    71   } else {
    72     _Thread_Lock_release( lock, &lock_context );
    7398  }
     99}
     100
     101void _Thread_Change_priority(
     102  Thread_Control                *the_thread,
     103  Priority_Control               new_priority,
     104  void                          *arg,
     105  Thread_Change_priority_filter  filter,
     106  bool                           prepend_it
     107)
     108{
     109  the_thread = _Thread_Apply_priority(
     110    the_thread,
     111    new_priority,
     112    arg,
     113    filter,
     114    prepend_it
     115  );
     116  _Thread_Update_priority( the_thread );
    74117}
    75118
Note: See TracChangeset for help on using the changeset viewer.