op_intrpt_schedule_mcast_global()

摘要

在指定的时间为每个处理器和队列模块安排一个组播(mcast)中断。

语法

op_intrpt_schedule_mcast_global (time, code)
参数 类型 说明
time double 中断的安排时间
[该值是绝对仿真时间,而不是相对于当前仿真时间的延迟。如果“sim_time_quantum“首选项的值不为 0.0,time 将在内部被截断为指定量子(quantum)的整数倍。]
code int 与中断关联的用户定义数字代码
[该值是任意的、用户定义的整数,可用作所安排中断的识别代码;当中断调用进程时,可使用内核过程 op_intrpt_code() 获取该代码。]

返回类型

Evhandle

所安排中断的事件句柄。

[该返回值可以存储在状态变量中,以便在后续调用 op_ev_cancel() 时用于识别该中断。]

示例

/* Send a packet into the channel and calculate the transmission time that it requires. */
tx_time = (double) op_pk_total_size_get (pkptr) / DATA_RATE;
	op_pk_send (pkptr, 0);

/* Compute the next time at which the channel will become available, */
/* and assign the transmission opportunity a new "slot" index. */
chan_avail_time = op_sim_time () + tx_time; slot_index++;

/* Notify processors in all terminals of the availability time and slot index. */
op_intrpt_schedule_mcast_global (chan_avail_time, slot_index);

详情

调用该内核过程会在仿真事件列表上放置新事件;这些新事件表示一个安排在指定时间传送的组播中断。事件一经安排,该内核过程就把控制权返回给调用进程,调用进程随即可以自由地进行任何活动。这些事件将在安排的仿真时间发生,但不会先于为该特定仿真时间安排的其他更高优先级事件的执行。当所有较早的事件都已执行完毕,且第一个组播中断事件位于仿真事件列表的头部时,其仿真时间被确立为当前仿真时间,事件随即执行。事件的执行会使组播中断被传送到各模块。每个模块的进程都可以通过内核过程 op_intrpt_code() 获取与中断关联的指定代码。

当组播中断表示某项可选活动时,有时由于条件变化而需要取消该组播中断。取消中断要求把该内核过程返回的事件句柄存储在状态变量中,并在稍后传递给取消内核过程,如下例所示:

/* state variable declaration */
Evhandle \evh;

/* multicast interrupt scheduling */
evh = op_intrpt_schedule_mcast_global (stime, 22);

/* multicast interrupt cancelling */
op_ev_cancel (evh);

用途

提供了一种机制,使一个进程能够远程调用所有进程,而无需它们之间存在物理数据包流或统计量连线。当一个进程需要提醒其他进程某件值得关注的事情已经发生时(例如卫星进程指示一个传输时隙的开始),这会很有用。

错误

  • 程序中止:内存分配失败。
  • 可恢复错误:指定时间 (<time>) 小于当前时间。
  • 可恢复错误:指定时间 (<time>) 是无效的双精度值。

参考

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