---
name: "ACE_Sched_Priority_Iterator"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Sched_Priority_Iterator"
---

# ACE\_Sched\_Priority\_Iterator(3)

An iterator over the OS-defined scheduling priorities.

## NAME

ACE\_Sched\_Priority\_Iterator -  An iterator over the OS-defined scheduling priorities.

## SYNOPSIS

```
#include <ACE/Sched_Params.h>
class ACE_Sched_Priority_Iterator
{
  public:
    ACE_Sched_Priority_Iterator (
        const ACE_Sched_Params::Policy &policy,
        int scope = ACE_SCOPE_THREAD
        );
    ~ACE_Sched_Priority_Iterator (void);
    int more (void) const;
    int priority (void) const;
    void next (void);
    const ACE_Sched_Params::Policy &policy (void) const;
    int scope (void) const;
  private:
    ACE_Sched_Params::Policy policy_;
    int scope_;
    int priority_;
    int done_;
};
```

## DESCRIPTION

The order of priorities (numeric value vs. importance) is OS dependant, it can be the case that the priorities are not even contigous.  This class permits iteration over priorities using the iterator pattern.

## PUBLIC MEMBERS

```
ACE_Sched_Priority_Iterator (
    const ACE_Sched_Params::Policy &policy,
    int scope = ACE_SCOPE_THREAD
    );
```

Initialize the iterator, the arguments define the scheduling policy and scope for the priorities (see ACE\_Sched\_Param).

```
~ACE_Sched_Priority_Iterator (void);
```

Default dtor.

```
int more (void) const;
```

Check if there are more priorities.

```
int priority (void) const;
```

Return the current priority.

```
void next (void);
```

Move to the next priority. The iteration is from lowest to highest importance.

```
const ACE_Sched_Params::Policy &policy (void) const;
```

Accessor for the scheduling policy over which we are iterating.

```
int scope (void) const;
```

Accessor for the scheduling

## PRIVATE MEMBERS

```
ACE_Sched_Params::Policy policy_;
```

```
int scope_;
```

The Scheduling policy (FIFO, RR, etc.) and scheduling scope (PROCESS, SYSTEM) we are iterating on.

```
int priority_;
```

The current priority.

```
int done_;
```

This is set to 1 when there are no more priorities. Cannot easily compare against the highest priority on platforms were priorities are non-contigous or descending.

## CREATION DATE

28 January 1997

## AUTHOR

David Levine and Carlos O'Ryan

## LIBRARY

ACE
