librpc/src/rpc_thread_factory.cc
/**
 * Converts relative thread priorities to absolute value based on posix
 * thread scheduler policy
 *
 *  The idea is simply to divide up the priority range for the given policy
 * into the correpsonding relative priority level (lowest..highest) and
 * then pro-rate accordingly.
 */
Converts relative thread priorities to absolute value based on posix
thread scheduler policy

The idea is simply to divide up the priority range for the given policy
into the correpsonding relative priority level (lowest..highest) and
then pro-rate accordingly.
Converts relative thread priorities to absolute value based on posix thread scheduler policy The idea is simply to divide up the priority range for the given policy into the correpsonding relative priority level ( lowest .. highest ) and then pro - rate accordingly .
static int toPthreadPriority(rpc_thread_factory::POLICY policy, rpc_thread_factory::PRIORITY priority) {
  int pthread_policy = toPthreadPolicy(policy);
  int min_priority = 0;
  int max_priority = 0;
#ifdef HAVE_SCHED_GET_PRIORITY_MIN
  min_priority = sched_get_priority_min(pthread_policy);
#endif
#ifdef HAVE_SCHED_GET_PRIORITY_MAX
  max_priority = sched_get_priority_max(pthread_policy);
#endif
  int quanta = (rpc_thread_factory::HIGHEST - rpc_thread_factory::LOWEST) + 1;
  float stepsperquanta = (float) (max_priority - min_priority) / quanta;
  if (priority <= rpc_thread_factory::HIGHEST) {
    return (int) (min_priority + stepsperquanta * priority);
  } else {
    assert(false);
    return (int) (min_priority + stepsperquanta * rpc_thread_factory::NORMAL);
  }
}
static int toPthreadPriority ( rpc_thread_factory :: POLICY policy , rpc_thread_factory :: PRIORITY priority ) { int pthread_policy = toPthreadPolicy ( policy ) ; int min_priority = 0 ; int max_priority = 0 ; #ifdef HAVE_SCHED_GET_PRIORITY_MIN min_priority = sched_get_priority_min ( pthread_policy ) ; #endif #ifdef HAVE_SCHED_GET_PRIORITY_MAX max_priority = sched_get_priority_max ( pthread_policy ) ; #endif int quanta = ( rpc_thread_factory :: HIGHEST - rpc_thread_factory :: LOWEST ) + 1 ; float stepsperquanta = ( float ) ( max_priority - min_priority ) / quanta ; if ( priority <= rpc_thread_factory :: HIGHEST ) { return ( int ) ( min_priority + stepsperquanta * priority ) ; } else { assert ( false ) ; return ( int ) ( min_priority + stepsperquanta * rpc_thread_factory :: NORMAL ) ; } }
Converts relative thread priorities to absolute value based on posix
 thread scheduler policy
Converts relative thread priorities to absolute value based on posix thread scheduler policy
// should never get here for priority increments.