#include <ACE/Sched_Params.h>
class ACE_Sched_Params {
public:
typedef int Policy;
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 );
~ACE_Sched_Params (void);
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_Value &quantum (void) const;
void quantum (const ACE_Time_Value &);
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:
Policy policy_;
ACE_Sched_Priority priority_;
int scope_;
ACE_Time_Value quantum_;
};
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 ()).
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
);
~ACE_Sched_Params (void);
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_Value &quantum (void) const;
void quantum (const ACE_Time_Value &);
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
);