op_ev_ici()
摘要
获取与事件关联的 ICI。
语法
op_ev_ici (evhandle)
| 参数 | 类型 | 说明 |
|---|---|---|
evhandle |
Evhandle |
标识该事件的事件句柄 [事件句柄可以从本包中的多个内核过程获取,例如 op_ev_current()、op_ev_seek_time() 和 op_ev_next(),以及 op_intrpt_schedule_self() 等其他内核过程。] |
返回类型
Ici*
指向与事件关联的 ICI 的指针。
当没有与事件关联的 ICI 或发生可恢复错误时,返回常量 OPC_NIL。
示例
/* Obtain the ICI for the next local self intrpt */
/* if there are any. */
ici_ptr = OPC_NIL;
event = op_ev_next_local (op_ev_current ());
while (op_ev_valid (event))
{
if (op_ev_type (event) == OPC_INTRPT_SELF)
{
/* This is the first self intrpt, so */
/* get the ICI and break out of the loop. */
ici_ptr = op_ev_ici (event);
break;
}
/* It must not have been a self intrpt. */
/* Try the next one. */
event = op_ev_next_local (event);
}
详情
事件携带多种类型的信息:事件类型、与事件关联的代码,以及可选的 ICI。获取指向 ICI 的指针后,进程即可通过 op_ici_attr_get() 提取其内容。
**注意:**调用 op_ev_ici() 不会移除 ICI;它仍然随事件保持安装状态。
用途
提供了一种获取与事件关联的 ICI 指针的机制。获取指针后,即可通过内核过程 op_ici_attr_get() 提取 ICI 的内容。
该内核过程通常应用于当前事件(当前事件的 Evhandle 可通过内核过程 op_ev_current() 获取),以获取源进程在生成事件时放入随附 ICI 中的信息。
错误
- 程序中止:段错误。(由于格式错误的事件句柄)
- 可恢复错误:事件句柄指向的事件无效或当前未被计划。
参考
- 使用内核过程 op_ev_valid() 判断 Evhandle 是否有效
- 使用内核过程 op_ev_type() 获取事件的类型
- 使用内核过程 op_ev_src_id() 获取源对象的 ID
- 使用内核过程 op_ev_dst_id() 获取目标对象的 ID
- 使用内核过程 op_ev_time() 获取事件的计划时间