1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef __MSG_TASK__
- #define __MSG_TASK__
- #include <functional>
- #include <LocThread.h>
- namespace loc_util {
- struct LocMsg {
- inline LocMsg() {}
- inline virtual ~LocMsg() {}
- virtual void proc() const = 0;
- inline virtual void log() const {}
- };
- class MsgTask {
- const void* mQ;
- LocThread mThread;
- public:
- ~MsgTask() = default;
- MsgTask(const char* threadName = NULL);
- void sendMsg(const LocMsg* msg) const;
- void sendMsg(const std::function<void()> runnable) const;
- };
- }
- #endif
|