60 lines
1.8 KiB
C
60 lines
1.8 KiB
C
|
#ifndef __HGEVENT_H__
|
|||
|
#define __HGEVENT_H__
|
|||
|
|
|||
|
#include "HGDef.h"
|
|||
|
#include "HGBaseErr.h"
|
|||
|
|
|||
|
HG_DECLARE_HANDLE(HGEvent);
|
|||
|
|
|||
|
/* 创建事件
|
|||
|
* 参数:
|
|||
|
* 1) manualReset: in, 是否手动设置
|
|||
|
* 2) initState: in, 初始化时是否有信号
|
|||
|
* 3) event: out, 事件句柄
|
|||
|
* 说明:
|
|||
|
* 1) 当manualReset为HGTRUE时, HGBase_WaitEvent和HGBase_WaitEventTimeout调用后, 事件仍然为有信号
|
|||
|
* 2) 当manualReset为HGFALSE时, HGBase_WaitEvent和HGBase_WaitEventTimeout调用后, 事件为无信号
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_CreateEvent(HGBool manualReset, HGBool initState, HGEvent* event);
|
|||
|
|
|||
|
/* 销毁事件
|
|||
|
* 参数:
|
|||
|
* 1) event: in, 事件句柄
|
|||
|
* 说明:
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_DestroyEvent(HGEvent event);
|
|||
|
|
|||
|
/* 无限等待事件
|
|||
|
* 参数:
|
|||
|
* 1) event: in, 事件句柄
|
|||
|
* 说明:
|
|||
|
* 1) 如果创建时的manualReset为HGTRUE, 返回前不会将事件置为无信号;否则,返回前会将事件置为无信号
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_WaitEvent(HGEvent event);
|
|||
|
|
|||
|
/* 等待事件, 带超时时间
|
|||
|
* 参数:
|
|||
|
* 1) event: in, 事件句柄
|
|||
|
* 2) milliseconds: in, 超时时间, 毫秒
|
|||
|
* 说明:
|
|||
|
* 1) 在milliseconds时间内如果事件有信号,立即返回
|
|||
|
* 2) 如果一直无信号, 在milliseconds毫秒后也立即返回, 返回值为HGBASE_ERR_WAIT_TIMEOUT
|
|||
|
* 3) 如果创建时的manualReset为HGTRUE, 返回前不会将事件置为无信号;否则,返回前会将事件置为无信号
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_WaitEventTimeout(HGEvent event, HGUInt milliseconds);
|
|||
|
|
|||
|
/* 使事件有信号
|
|||
|
* 参数:
|
|||
|
* 1) event: in, 事件句柄
|
|||
|
* 说明:
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_SetEvent(HGEvent event);
|
|||
|
|
|||
|
/* 使事件无信号
|
|||
|
* 参数:
|
|||
|
* 1) event: in, 事件句柄
|
|||
|
* 说明:
|
|||
|
*/
|
|||
|
HGEXPORT HGResult HGAPI HGBase_ResetEvent(HGEvent event);
|
|||
|
|
|||
|
#endif /* __HGEVENT_H__ */
|