2022-05-24 02:01:36 +00:00
|
|
|
|
#ifndef __HGMSGPUMP_H__
|
2022-05-21 10:09:34 +00:00
|
|
|
|
#define __HGMSGPUMP_H__
|
|
|
|
|
|
|
|
|
|
#include "HGDef.h"
|
|
|
|
|
#include "HGBaseErr.h"
|
|
|
|
|
|
|
|
|
|
HG_DECLARE_HANDLE(HGMsgPump);
|
|
|
|
|
|
2022-10-12 03:35:09 +00:00
|
|
|
|
#pragma pack(push)
|
|
|
|
|
#pragma pack(4)
|
|
|
|
|
|
2022-05-24 02:01:36 +00:00
|
|
|
|
/* 消息结构体, 可以自定义 */
|
2022-05-21 10:09:34 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2022-05-24 02:01:36 +00:00
|
|
|
|
HGUInt id; /* 消息ID, 不能为0 */
|
|
|
|
|
HGPointer data; /* 携带的数据 */
|
2022-05-21 10:09:34 +00:00
|
|
|
|
}HGMsg;
|
|
|
|
|
|
2022-10-12 03:35:09 +00:00
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
typedef void (HGAPI *HGMsgPumpFunc)(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
2022-05-21 10:09:34 +00:00
|
|
|
|
|
|
|
|
|
HGEXPORT HGResult HGAPI HGBase_CreateMsgPump(HGMsgPump *msgPump);
|
|
|
|
|
|
|
|
|
|
HGEXPORT HGResult HGAPI HGBase_DestroyMsgPump(HGMsgPump msgPump);
|
|
|
|
|
|
|
|
|
|
HGEXPORT HGResult HGAPI HGBase_RunMsgPump(HGMsgPump msgPump, HGMsgPumpFunc func, HGPointer param);
|
|
|
|
|
|
|
|
|
|
HGEXPORT HGResult HGAPI HGBase_PostPumpMessage(HGMsgPump msgPump, const HGMsg *msg);
|
|
|
|
|
|
|
|
|
|
HGEXPORT HGResult HGAPI HGBase_ExitMsgPump(HGMsgPump msgPump);
|
|
|
|
|
|
|
|
|
|
#endif /* __HGMSGPUMP_H__ */
|