//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::../_part_attributes.asciidoc[]

:leveloffset: -2

[[lang-tut-time-chapter-urgency]]
== Urgency

indexterm:[urgency]
In CIF, urgency indicates whether or not time may progress.
CIF has three forms of urgency: event urgency, location urgency, and edge urgency.
Edge urgency should be avoided, and is not explained here.

indexterm:[urgency,event]
indexterm:[event,urgency]

=== Event urgency

By default, all events in CIF are _urgent_.
Events being urgent means that edges are taken as soon as possible.
In other words, event transitions take priority over time transitions.
Time can only progress if no event transitions are possible.
It is not possible to make events non-urgent in a CIF model, but specific tools may allow making events non-urgent.

indexterm:[urgency,location]
indexterm:[location,urgency]

[[lang-tut-time-urgloc]]
=== Location urgency

Consider the following CIF specification:

[source, cif]
----
automaton use_case:
  location first:
    initial;
    edge tau goto second;

  location second:
    edge tau goto done;

  location done;
end
----

This automaton represents a use case, which goes from one location to the next.
The state space is:

image::{lang-tut-imgsdir}/time/usecase_nonurg_state_space.png[]

The states are labeled with the names of the current locations of automaton `use_case` and the current values of variable time.
At the end of the use case, no events are possible, and thus time can progress infinitely.
To force that in location `done` no time can progress, the location can be made urgent:

[source, cif]
----
automaton use_case:
  location first:
    initial;
    edge tau goto second;

  location second:
    edge tau goto done;

  location done:
    urgent; // Location is now urgent.
end
----

The resulting state space is:

image::{lang-tut-imgsdir}/time/usecase_urgloc_state_space.png[]
