op_ev_type()
摘要
获取事件的类型。
语法
op_ev_type (evhandle)
| 参数 | 类型 | 说明 |
|---|---|---|
evhandle |
Evhandle |
标识该事件的事件句柄 [事件句柄可以从本包中的多个内核过程获取,例如 op_ev_current()、op_ev_seek_time() 和 op_ev_next(),以及 op_intrpt_schedule_self() 等其他内核过程。] |
返回类型
int
指定事件的类型(也称为中断类型)。
这是一个整数数字代码,表示可能的事件类型之一(参见第 15 页的表 59“中断类型符号常量“)。如果发生可恢复错误,将返回常量 OPC_INTRPT_INVALID。
示例
/* Obtain the currently executing event (it must be at this module, */
/* since this module woke up.) and the one after it. */
this_event = op_ev_current ();
next_event = op_ev_next_local (this_event);
/* Loop through all of the events scheduled for this module */
/* and cancel any that are retransmission timers. */
while (op_ev_valid (next_event))
{
if ((op_ev_type (next_event) == OPC_INTRPT_SELF) &&
(op_ev_code (next_event) == RETRANS_TIMER))
{
retrans_timer = next_event;
next_event = op_ev_next_local (retrans_timer);
op_ev_cancel (retrans_timer);
}
else
/* Obtain the next event; if there are no more events, op_ev_next_local () */
/* will return an invalid event handle and the loop will terminate. */
next_event = op_ev_next_local (next_event);
}
详情
该内核过程返回一个数值,可与下列中断类型符号常量之一进行比较:
OPC_INTRPT_ACCESS—访问中断OPC_INTRPT_BEGSIM—begin simulation 中断OPC_INTRPT_ENDSIM—end simulation 中断OPC_INTRPT_ESYS_INTERFACE—外部系统中断OPC_INTRPT_ESYS_INTERFACE_EXT—外部系统中断(来自协同仿真器)OPC_INTRPT_FAIL—节点/链路故障中断OPC_INTRPT_MCAST—组播中断OPC_INTRPT_PROCEDURE—过程中断OPC_INTRPT_PROCESS—进程中断OPC_INTRPT_RECOVER—节点/链路恢复中断OPC_INTRPT_REGULAR—常规中断OPC_INTRPT_REMOTE—远程中断)OPC_INTRPT_REMOTE_END_RCV—数据包到达接收端的结束OPC_INTRPT_REMOTE_START_RCV—数据包到达接收端的开始OPC_INTRPT_REMOTE_START_XMT—数据包在发送端开始传输 “split_start_radio_transmission“ 偏好为 TRUEOPC_INTRPT_SELF—自中断OPC_INTRPT_SELF_END_XMT—数据包在发送端传输的结束OPC_INTRPT_STAT—统计中断OPC_INTRPT_STRM—流中断
用途
提供了一种确定 Evhandle 所指事件类型的机制。
错误
- 程序中止:段错误。(由于格式错误的事件句柄)
- 可恢复错误:事件句柄指向的事件无效或当前未被计划。
参考
- 使用内核过程 op_ev_valid() 判断 Evhandle 是否有效
- 使用内核过程 op_ev_code() 确定自中断、远程中断或组播中断的代码
- 使用内核过程 op_ev_strm() 确定与流中断关联的数据流索引
- 使用内核过程 op_ev_stat() 确定与统计中断关联的输入统计量索引
- 使用内核过程 op_ev_time() 确定事件的计划时间
- 使用内核过程 op_ev_ici() 获取与事件关联的 ICI