ACE  6.3.3
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ACE_Sched_Params Class Reference

Container for scheduling-related parameters. More...

#include <Sched_Params.h>

Collaboration diagram for ACE_Sched_Params:
Collaboration graph
[legend]

Public Types

typedef int Policy
 

Public Member Functions

 ACE_Sched_Params (const Policy policy, const ACE_Sched_Priority priority, const int scope=ACE_SCOPE_THREAD, const ACE_Time_Value &quantum=ACE_Time_Value::zero)
 Constructor. More...
 
 ~ACE_Sched_Params (void)
 Termination. More...
 
Policy policy (void) const
 
void policy (const Policy)
 
ACE_Sched_Priority priority (void) const
 
void priority (const ACE_Sched_Priority)
 
int scope (void) const
 
void scope (const int)
 
const ACE_Time_Valuequantum (void) const
 
void quantum (const ACE_Time_Value &)
 

Static Public Member Functions

static int priority_min (const Policy, const int scope=ACE_SCOPE_THREAD)
 
static int priority_max (const Policy, const int scope=ACE_SCOPE_THREAD)
 
static int next_priority (const Policy, const int priority, const int scope=ACE_SCOPE_THREAD)
 
static int previous_priority (const Policy, const int priority, const int scope=ACE_SCOPE_THREAD)
 

Private Attributes

Policy policy_
 Scheduling policy. More...
 
ACE_Sched_Priority priority_
 
int scope_
 
ACE_Time_Value quantum_
 

Detailed Description

Container for scheduling-related parameters.

ACE_Sched_Params are passed via <ACE_OS::sched_params> to the OS to specify scheduling parameters. These parameters include scheduling policy, such as FIFO (ACE_SCHED_FIFO), round-robin (ACE_SCHED_RR), or an implementation-defined "OTHER" (ACE_SCHED_OTHER), to which many systems default; priority; and a time-slice quantum for round-robin scheduling. A "scope" parameter specifies whether the ACE_Sched_Params applies to the current process, current lightweight process (LWP) (on Solaris), or current thread. Please see the "NOTE" below about not all combinations of parameters being legal on a particular platform. For the case of thread priorities, it is intended that <ACE_OS::sched_params> usually be called from <main> before any threads have been spawned. If spawned threads inherit their parent's priority (I think that's the default behavior for all of our platforms), then this sets the default base priority. Individual thread priorities can be adjusted as usual using <ACE_OS::thr_prio> or via the ACE_Thread interface. See the parameter descriptions in the private: section below.

Note
This class does not do any checking of parameters. It is just a container class. If it is constructed with values that are not supported on a platform, the call to <ACE_OS::sched_params> will fail by returning -1 with EINVAL (available through <ACE_OS::last_error>).

Member Typedef Documentation

Constructor & Destructor Documentation

ACE_Sched_Params::ACE_Sched_Params ( const Policy  policy,
const ACE_Sched_Priority  priority,
const int  scope = ACE_SCOPE_THREAD,
const ACE_Time_Value quantum = ACE_Time_Value::zero 
)
inline

Constructor.

ACE_Sched_Params::~ACE_Sched_Params ( void  )
inline

Termination.

Member Function Documentation

int ACE_Sched_Params::next_priority ( const Policy  policy,
const int  priority,
const int  scope = ACE_SCOPE_THREAD 
)
static

The next higher priority. "Higher" refers to scheduling priority, not to the priority value itself. (On some platforms, higher scheduling priority is indicated by a lower priority value.) If "priority" is already the highest priority (for the specified policy), then it is returned.

ACE_Sched_Params::Policy ACE_Sched_Params::policy ( void  ) const
inline
void ACE_Sched_Params::policy ( const Policy  policy)
inline
int ACE_Sched_Params::previous_priority ( const Policy  policy,
const int  priority,
const int  scope = ACE_SCOPE_THREAD 
)
static

The previous, lower priority. "Lower" refers to scheduling priority, not to the priority value itself. (On some platforms, lower scheduling priority is indicated by a higher priority value.) If "priority" is already the lowest priority (for the specified policy), then it is returned.

ACE_Sched_Priority ACE_Sched_Params::priority ( void  ) const
inline
void ACE_Sched_Params::priority ( const ACE_Sched_Priority  priority)
inline
int ACE_Sched_Params::priority_max ( const Policy  policy,
const int  scope = ACE_SCOPE_THREAD 
)
static
int ACE_Sched_Params::priority_min ( const Policy  policy,
const int  scope = ACE_SCOPE_THREAD 
)
static
const ACE_Time_Value & ACE_Sched_Params::quantum ( void  ) const
inline
void ACE_Sched_Params::quantum ( const ACE_Time_Value quant)
inline
int ACE_Sched_Params::scope ( void  ) const
inline
void ACE_Sched_Params::scope ( const int  scope)
inline

Member Data Documentation

Policy ACE_Sched_Params::policy_
private

Scheduling policy.

ACE_Sched_Priority ACE_Sched_Params::priority_
private

Default <priority_>: for setting the priority for the process, LWP, or thread, as indicated by the scope_ parameter.

ACE_Time_Value ACE_Sched_Params::quantum_
private

The <quantum_> is for time slicing. An ACE_Time_Value of 0 has special significance: it means time-slicing is disabled; with that, a thread that is running on a CPU will continue to run until it blocks or is preempted. Currently ignored if the OS doesn't directly support time slicing, such as on VxWorks, or setting the quantum (can that be done on Win32?).

int ACE_Sched_Params::scope_
private

<scope_> must be one of the following: ACE_SCOPE_PROCESS: sets the scheduling policy for the process, and the process priority. On some platforms, such as Win32, the scheduling policy can only be set at process scope. ACE_SCOPE_LWP: lightweight process scope, only used with Solaris threads. ACE_SCOPE_THREAD: sets the scheduling policy for the thread, if the OS supports it, such as with Posix threads, and the thread priority. NOTE: I don't think that these are the same as POSIX contention scope. POSIX users who are interested in, and understand, contention scope will have to set it by using system calls outside of ACE.


The documentation for this class was generated from the following files: