op_intrpt_force_remote()

Abstract

Forces a remote interrupt for the specified processor or queue. This immediately invokes the appropriate process in that module and temporarily suspends execution of the current process.

Syntax

op_intrpt_force_remote (code, mod_objid)
Argument Type Description
code int user-defined numeric code for association with the interrupt
[This value is an arbitrary, user-defined integer which can be used as an identification code for the forced interrupt; the code can be obtained by the process that receives the interrupt, with the KP op_intrpt_code(). You can assign a text string that will be printed along with this code when it appears in ODB event banners and traces. See “Interrupt Code Map“ on page 507 for details.]
mod_objid Objid object ID of the processor or queue that will receive the interrupt
[A processor or queue object ID can be obtained from a number of KPs including: op_id_self(), op_topo_child(), and op_id_from_name().]

Return Type

void

no return value

Example

/* if the channel is currently in a collided state, then the packet will be */
/* at the head of the collision subqueue; remove it from there. */
if (!op_subq_empty (INM_COLL_Q))
	{
	/* extract the packet from the subqueue */
	pk = op_subq_pk_remove (INM_COLL_Q, OPC_QPOS_HEAD);

	/* install the ship id in global variable */
	op_pk_nfd_get (pk, “ship_index”, &Inm_Ship_Id);

	/* determine the origin module for this transmission */
	/* and notify it of the collision so that it can retransmit */
	origin_object_id = op_pk_stamp_mod_get (pk);
	op_intrpt_force_remote (INM_PK_STATUS_COLLIDED, origin_object_id);

	/* increment accumulator for number of collisions */
	num_pk_collided++;
	}

Details

This KP causes a forced event involving the specified module, without any delay or scheduling, so the simulation event list is not involved in this operation. The forced event causes an immediate invocation of the appropriate process in the remote module with a remote interrupt. While the remote process is responding to the interrupt, the invoking process is suspended; when the remote process enters an unforced state and releases control, this KP will return control to the invoking process, which will resume at the statement following the call to this KP.

The specified user-defined numeric code will be available to the interrupted process via the KP op_intrpt_code().

WARNING: An infinite interrupt loop can result if processes force interrupts in a cyclic pattern.

Forcing an interrupt on a child of the current process is illegal, because the remote interrupt is usually handled by the root process and this can lead to the process invoking itself. Also see op_pro_invoke() on page 17.

Purpose

Provides a mechanism for remotely and immediately invoking one process model from another, without requiring a physical packet stream or statistics wire connection between them. In effect, the remote process model is invoked like a “subroutine” to the calling process model. This is useful when a process model needs to alert another process model that something of interest has occurred, and it should respond to this event before any other interrupts scheduled for the current simulation time. Note that remote interrupts must only be delivered to processors and queues; otherwise an error will occur.

Errors

  • Recoverable Error: Object (<mod_objid>) has incorrect type; queue or processor objects are expected.
  • Recoverable Error: Unable to execute interrupt at process (<process_id>). Process is already within an invocation.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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