op_ev_next()
Abstract
Obtains the event handle that refers to the event following the specified event (sequential simulations only).
Syntax
op_ev_next (evhandle)
| Argument | Type | Description |
|---|---|---|
evhandle |
Evhandle |
event handle that identifies the event [An event handle can be obtained from several KPs in this package—such as op_ev_current(), op_ev_seek_time(), and op_ev_next()—and others such as op_intrpt_schedule_self().]. |
Return Type
Evhandle
Event handle for the event that immediately follows the specified event in the event list.
Example
/* For each stream interrupt, print out the information. */
event = op_ev_current ();
while (op_ev_valid (event))
{
if (op_ev_type (event) == OPC_INTRPT_STRM)
{
printf (“src:%d, dest:%d, stream index:%d, time:%f\n”,
op_ev_src_id (event), op_ev_dst_id (event),
op_ev_strm (event), op_ev_time (event));
}
event = op_ev_next (event);
}
Details
For scheduled events, the next event is the following event in the event list. In the case of the last scheduled event, an invalid event handle is returned. For forced events occurring in succession, the next event is considered to be the event that generated the current event. This seems somewhat paradoxical but results from the fact that this is where execution will resume after the current event completes. Figure 47 illustrates the meaning of the term next event in the cases of both forced and scheduled events.
Figure 47: Next Event – Forced and Scheduled

Purpose
Provides a mechanism to step through future events in the expected order of execution (execution order may change as object or interrupt priorities are modified and events are canceled; however, at the time that this KP is called, these changes cannot be anticipated).
Note: This KP works only in a sequential simulation context. In a parallel simulation, where events in the current time cell might be executed in varying fashion based on what the threads are doing, it will act as if there are no events after the current one.
Errors
- Program Abort: Segmentation violation. (due to a malformed event handle)
- Recoverable Error: Event handle refers to an event that is either invalid or not currently scheduled.
Reference
- Use the KP op_ev_current() to obtain the current event’s Evhandle
- Use the KP op_ev_next_local() to obtain the succeeding local events’ Evhandles