op_ev_current()
Abstract
Obtains the event handle that refers to the currently executing event.
Syntax
op_ev_current ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Evhandle
Event handle for the currently executing event.
Example
/* Obtain the currently executing event */
this_event = op_ev_current ();
/* If it is a packet arrival, get the packet. */
/* If it is a self interrupt, send the packet on. */
if (op_ev_type (this_event) == OPC_INTRPT_STRM)
pkptr = op_pk_get (op_ev_strm (this_event));
else if (op_ev_type (this_event) == OPC_INTRPT_SELF)
op_pk_send (pkptr, 0);
Details
When this KP is invoked from a process within a processor or queue module, the Evhandle refers to the event that interrupted the process. Thus some Event Package KPs used with op_ev_current() return the same value as some Intrpt Package KPs; for example, op_ev_type (op_ev_current()) is equivalent to op_intrpt_type().
Purpose
Provides a mechanism to obtain the Evhandle of the current event. This is a useful starting point for looping through all events (using op_ev_next()) or through local events (using op_ev_next_local()).
Errors
- No errors are trapped.
Reference
- Use the KP op_ev_next() to obtain the succeeding events’ Evhandle(s)
- Use the KP op_ev_next_local() to obtain the succeeding local events’ Evhandle(s)