op_intrpt_priority_set()
Abstract
Sets the priority of interrupts to the invoking process with a specified type and code.
Syntax
op_intrpt_priority_set (type, code, priority)
| Argument | Type | Description |
|---|---|---|
type |
int |
type of interrupt [This is an integer numeric code that represents one of the possible interrupt types (see Table 59 “Interrupt Type Symbolic Constants“ on page 15)]. |
code |
int |
user-defined numeric code for association with the interrupt [This argument is the code value for self, remote, process, and multicast interrupts; the input stream index for stream interrupts; the output stream index for access interrupts; and the statistic input index for statistic interrupts.] |
priority |
int |
priority setting [The default value is 0.] |
Return Type
void
no return value
Example
/* Set the priorities of the three instreams. */
/* stream a has highest priority, stream b middle */
/* priority, stream c lowest priority of the three. */
op_intrpt_priority_set (OPC_INTRPT_STRM, STREAM_A, 15);
op_intrpt_priority_set (OPC_INTRPT_STRM, STREAM_B, 10);
op_intrpt_priority_set (OPC_INTRPT_STRM, STREAM_C, 5);
Details
Any number of events can be scheduled for one module at the same simulation instant. When comparing two interrupts, the one with the highest priority setting will occur first. If the priorities are equal, the first event put into the event list will occur first. The default value for all interrupts is 0. Priorities can be set to negative integer values.
This KP affects events that are already in the queue and those that are submitted after the call to this KP. Only interrupts delivered to the invoking process are affected.
For a detailed description of event-ordering mechanisms in the Simulation Kernel, see “Event Prioritization for Simultaneous Event Execution“ on page 166 of the Modeling Concepts manual.
Note: This KP is not supported by the parallel kernel. For details, see “Unsafe and Unsupported KPs“ on page 426.
Purpose
Provides a mechanism whereby a process can prioritize its interrupts so that some will occur before others if they are scheduled for the same simulation time. For example, a process might wish to receive a packet before a timer expires. If stream interrupts have a higher priority, when a stream interrupt and a self interrupt are scheduled for the same instant in simulation time, the stream interrupt will occur first, allowing the process to cancel a retransmission timer before it expires.
Errors
- Program Abort: KP requires process context.
- Recoverable Error: Interrupt type (
<type>) is unrecognized.
Reference
- Use the KP op_intrpt_priority_get() to obtain the priority of an interrupt
- Use the KP op_intrpt_priority_set_next() to set the priority of an interrupt for only its next occurrence