op_ev_dst_id()
摘要
获取事件目标模块的对象 ID。
语法
op_ev_dst_id (evhandle)
| 参数 | 类型 | 说明 |
|---|---|---|
evhandle |
Evhandle |
标识该事件的事件句柄 [事件句柄可以从本包中的多个内核过程获取,例如 op_ev_current()、op_ev_seek_time() 和 op_ev_next(),以及 op_intrpt_schedule_self() 等其他内核过程。] |
返回类型
Objid
作为指定事件目标的模块的对象 ID。
发生可恢复错误时返回符号常量 OPC_OBJID_INVALID。
示例
/* Find the first event for the receiver after */
/* 5.0 seconds from the current time and cancel it. */
time = op_sim_time () + 5.0;
event = op_ev_seek_time (time, OPC_EVSEEK_TIME_POST);
while (op_ev_valid (event))
{
if (op_ev_dst_id (event) == recv_id)
{
op_ev_cancel (event);
break;
}
else
event = op_ev_next (event);
}
详情
该内核过程对所有事件类型均有效,组播中断除外,因为这类中断没有单一的目标模块。
用途
提供了一种确定事件将在哪个对象处递送的机制。
错误
- 程序中止:段错误。(由于格式错误的事件句柄)
- 可恢复错误:事件句柄指向的事件无效或当前未被计划。
- 可恢复错误:该事件是组播中断,因此没有单一的目标对象。
- 可恢复错误:事件没有目标对象。(即不属于任何特定模块)
参考
- 使用内核过程 op_ev_valid() 判断 Evhandle 是否有效
- 使用内核过程 op_ev_src_id() 获取源对象的 ID
- 使用内核过程 op_ev_time() 获取事件的计划时间
- 使用内核过程 op_ev_type() 获取事件的类型