code_app/modules/base/HGMsgPump.h

33 lines
832 B
C
Raw Normal View History

#ifndef __HGMSGPUMP_H__
#define __HGMSGPUMP_H__
#include "HGDef.h"
#include "HGBaseErr.h"
HG_DECLARE_HANDLE(HGMsgPump);
#pragma pack(push)
#pragma pack(4)
/* 消息结构体, 可以自定义 */
typedef struct
{
HGUInt id; /* 消息ID, 不能为0 */
HGPointer data; /* 携带的数据 */
}HGMsg;
#pragma pack(pop)
typedef void (HGAPI *HGMsgPumpFunc)(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
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__ */