op_intrpt_code()
Abstract
Obtains the numeric code associated with the current interrupt of the invoking process.
Syntax
op_intrpt_code ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
int
Numeric code associated with the current interrupt.
[This value is an integer with a user-defined interpretation; the value is supplied when an interrupt is requested via op_intrpt_schedule_self(), op_intrpt_schedule_remote(), op_intrpt_force_remote(), etc. Typically, the value identifies the purpose of the interrupt.]
Example
Excerpt adapted from: example model (models/std/x25); process model (x25_dce_chan); state (p7); exit execs.
switch (op_intrpt_type())
{
case OPC_INTRPT_SELF:
{
/* Test if the timer that expired is ’T13’ */
if (op_intrpt_code () == X25C_T13)
{
/* If this is the first expiration, retransmit the clear indication */
/* to the DTE and increment the expiration counter. */
if (retry_count [X25C_T13] == 0)
{
x25_pk_send_local (chan_vars->data_link, chan_vars->number,
X25_GFI_BASE, X25C_PT_CLEAR_INDICATION,
X25C_RC_LOC_PROC_ERROR, 50);
retry_count [X25C_T13]++;
x25_dce_trace_msg ("Timer T13 expired;
resend clear indication to DTE");
}
}
else
{. . .}
Details
This KP will produce valid results only when invoked after an interrupt that has an associated code. The types of interrupts that support these codes are self, process, remote, and procedure call interrupts.
Purpose
Provides a mechanism to determine the user-defined numeric code associated with an interrupt, in order to identify its purpose. This is necessary when there are several different interrupts of the same type pending, associated with different purposes. An example would be multiple time-out intervals delimited by self interrupts.
Errors
No errors are trapped.
Reference
- Use the KP op_intrpt_type() to determine the type of the current interrupt
- Use the KP op_intrpt_strm() to determine the stream index associated with the current interrupt
- Use the KP op_intrpt_stat() to determine the input statistic index associated with a statistic interrupt
- Use the KP op_intrpt_source() to determine the source object of the current interrupt
- Use the KP op_intrpt_ici() to obtain the ICI associated with the current interrupt