[ Advanced Control and Suspensions | Reference Manual | Alphabetic Index ]

# get_priority(-Priority)

Get the priority of the currently executing goal.

Priority
  A variable.

## Description

All goals in ECLiPSe execute under a certain priority. An execution can only be interrupted by the waking of a goal with a higher priority. Priorities are most relevant in data-driven algorithms, to specify that certain goals must do their work before others can meaningfully execute.

Priorities range from 1 (most urgent) to 12 (least urgent). The toplevel goal of an execution always runs at the lowest priority (12).

Warning: Although it is possible to write programs that only work correctly under a particular priority ordering, such practice is strongly discouraged. Priorities should only affect efficiency, never correctness.

### Modes and Determinism

- get_priority(-) is det

### Exceptions

(24) number expected
  Priority is neither variable nor number.

## Examples

        [eclipse 1]: get_priority(P).
        P = 12
        yes.

        [eclipse 2]: [user].
         p :- get_priority(P), writeln(prio=P).

        user       compiled traceable 120 bytes in 0.00 seconds
        yes.
        [eclipse 3]: suspend(p, 5, X->inst), X=1.
        prio = 5
        X = 1
        yes.

## See Also

call_priority / 2, make_suspension / 3, suspend / 3, suspend / 4, set_suspension_data / 3