op_ev_pending()

Abstract

Determines if the event is scheduled for future execution.

Syntax

op_ev_pending (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

Boolean

OPC_TRUE if the event is pending execution; OPC_FALSE if an error occurs or if the specified event has already begun or completed execution (this implicitly includes all forced events).

Example

/* Find the first event that is in the event list. */
/* (i.e., not a current or forced event) */
this_event = op_ev_current ();
while (!op_ev_pending (next_event))
	next_event = op_ev_next ();

/* Count the remote interrupts this module scheduled. */
ri_count = 0;
while (op_ev_valid (next_event))
	{
	if ((op_ev_type (next_event) == OPC_INTRPT_REMOTE) &&
		(op_ev_src_id (next_event) == my_id))
		{
		ri_count++;
		}
	next_event = op_ev_next (next_event);
	}

Details

An event is pending if it is in the event list and has not yet started. Events that have already occurred, the current event, and forced events are not pending.

Purpose

Provides a mechanism to determine whether an event has already occurred. Typically this is done to determine if an event may be canceled, because only pending events are allowed to be canceled.

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)

Reference

  • Use the KP op_ev_valid() to determine if the Evhandle is valid
  • Use the KP op_ev_type() to obtain the type of the event
  • Use the KP op_ev_time() to obtain the scheduled time of the event

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com