Example #1
0
static bool _Thread_Raise_priority_filter(
  Thread_Control   *the_thread,
  Priority_Control *new_priority,
  void             *arg
)
{
  return _Thread_Priority_less_than(
    the_thread->current_priority,
    *new_priority
  );
}
Example #2
0
static bool _POSIX_Threads_Sporadic_budget_TSR_filter(
    Thread_Control   *the_thread,
    Priority_Control *new_priority,
    void             *arg
)
{
    the_thread->real_priority = *new_priority;

    /*
     * If holding a resource, then do not change it.
     *
     * If this would make them less important, then do not change it.
     */
    return !_Thread_Owns_resources( the_thread ) &&
           _Thread_Priority_less_than( the_thread->current_priority, *new_priority );
}
Example #3
0
static bool _Thread_Inherit_priority_filter(
  Thread_Control   *inheritor,
  Priority_Control *new_priority,
  void             *arg
)
{
  Thread_Control *ancestor = arg;

  if ( _Scheduler_Get_own( inheritor ) == _Scheduler_Get_own( ancestor ) ) {
    *new_priority = ancestor->current_priority;
  }

  return _Thread_Priority_less_than(
    inheritor->current_priority,
    *new_priority
  );
}
Example #4
0
static bool _POSIX_Threads_Sporadic_budget_callout_filter(
    Thread_Control   *the_thread,
    Priority_Control *new_priority,
    void             *arg
)
{
    the_thread->real_priority = *new_priority;

    /*
     * If holding a resource, then do not change it.
     *
     * Make sure we are actually lowering it. If they have lowered it
     * to logically lower than sched_ss_low_priority, then we do not want to
     * change it.
     */
    return !_Thread_Owns_resources( the_thread ) &&
           _Thread_Priority_less_than( *new_priority, the_thread->current_priority );
}
static bool _Thread_Raise_real_priority_filter(
  Thread_Control   *the_thread,
  Priority_Control *new_priority_ptr,
  void             *arg
)
{
  Priority_Control real_priority;
  Priority_Control new_priority;
  Priority_Control current_priority;

  real_priority = the_thread->real_priority;
  new_priority = *new_priority_ptr;
  current_priority = _Thread_Get_priority( the_thread );

  new_priority = _Thread_Priority_highest( real_priority, new_priority );
  *new_priority_ptr = new_priority;

  the_thread->real_priority = new_priority;

  return _Thread_Priority_less_than( current_priority, new_priority );
}
static bool _RTEMS_tasks_Set_priority_filter(
  Thread_Control   *the_thread,
  Priority_Control *new_priority_p,
  void             *arg
)
{
  RTEMS_tasks_Set_priority_context *context;
  const Scheduler_Control          *scheduler;
  bool                              valid;
  Priority_Control                  current_priority;
  Priority_Control                  new_priority;

  context = arg;
  scheduler = _Scheduler_Get_own( the_thread );
  current_priority = _Thread_Get_priority( the_thread );

  context->scheduler = scheduler;
  context->old_priority = current_priority;

  new_priority = _RTEMS_Priority_To_core(
    scheduler,
    context->new_priority,
    &valid
  );

  *new_priority_p = new_priority;

  if ( !valid ) {
    context->status = RTEMS_INVALID_PRIORITY;
    return false;
  }

  the_thread->real_priority = new_priority;
  context->status = STATUS_SUCCESSFUL;

  return _Thread_Priority_less_than( current_priority, new_priority )
    || !_Thread_Owns_resources( the_thread );
}