op_intrpt_priority_set_next()
Abstract
Sets the priority of the next interrupt of the specified type and code.
Syntax
op_intrpt_priority_set_next (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
/* If the priority of stream interrupts are less than 5 */
/* set each one to five for the next packet arrival only. */
/* Check input streams 0-9. */
for (i = 0; i < 10; i++)
{
if (op_intrpt_priority_get (OPC_INTRPT_STRM, i) < 5)
op_intrpt_priority_set_next (OPC_INTRPT_STRM, i, 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.
Only the next interrupt of the specified type and code delivered to the invoking process is 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.
This KP sets the priority of the specified interrupt until the next time it occurs. Immediately after the occurrence of such an interrupt, the Simulation Kernel will re-set the priority to its original value. Thus the interrupt priority modification is only able to affect one interrupt delivery.
Note: This KP is not supported by the parallel kernel. For details, see “Unsafe and Unsupported KPs“ on page 426.
Purpose
Provides the capability to prioritize the next occurrence of an interrupt delivered to a process, so that the interrupt arrives before or after others if they are scheduled for the same simulation time. For example, a process may wish to receive the next statistic interrupt before a packet arrival, and then have the priorities revert to normal. This KP is useful for this case.
Errors
- Program Abort: KP requires process context.
- Recoverable Error: Interrupt type (
<type>) is unrecognized.
Reference
- Use the KP op_intrpt_priority_set() to set the priority of an interrupt
- Use the KP op_intrpt_priority_get() to obtain the priority of an interrupt