opnet之Interrupt Package

lmz:
中断是传递给进程的。
每一个节点内的进程都可以给自己/他人预设中断,也可以删除中断。

比如:
op_intrpt_clear_self()Cancels all self interrupts pending for the invoking process.
只能删除自己的中断。

op_intrpt_schedule_self()

In cases where a self interrupt is representing a time-out, or some similar event, it is sometimes useful to cancel the self interrupt if it becomes unnecessary (for example, when a time-out needs to be revoked due to an ack being received before the time-out elapses). Cancelling an interrupt requires that the event handle returned by this KP be stored in a state variable, to be later passed to the KP op_ev_cancel(), as in the following examples:

/* state variable declaration */
Evhandle \evh;

/* self interrupt scheduling */
evh = op_intrpt_schedule_self (sch_time, 5);

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

lmz:
这个函数预设的中断是给当前正在被唤醒的进程。
进程是在queue或者processor中,所以这个预设的中断是给了op_self_id().

op_intrpt_schedule_remote()

Syntax

op_intrpt_schedule_remote (time, code, mod_objid)

ArgumentTypeDescription
mod_objidObjidobject ID of the processor or queue which will receive the interrupt

for instance, a queue process can interrupt a processor in another node when it has saturated its packet capacity

lmz:
当前正在被唤醒的进程可以为其他节点内的processor或者queue预设中断。

op_intrpt_strm()

The two types of interrupts that are associated with streams are stream interrupts and access interrupts. In the former case, the stream associated with the interrupt will be an input stream on which a packet has arrived. In the latter case, the stream associated with the interrupt will be an output stream which is being accessed by the module to which it is connected.

lmz:
获取中断的流索引。
作判断之用。
op_intrpt_stat()获取数据中断的索引。

op_intrpt_code()

Provides a mechanism to determine the user-defined numeric code associated with an interrupt, in order to identify its purpose. This is necessary when there are several different interrupts of the same type pending, associated with different purposes.

lmz:
中断码往往是和以下的核心函数有关

  • op_intrpt_schedule_self()
  • op_intrpt_schedule_remote()
  • op_intrpt_force_remote()

tags:opnet

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值