新增:实现 EventQueue 类,单线程事件队列
This commit is contained in:
23
code/EventQueue.h
Normal file
23
code/EventQueue.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef EVENTQUEUE_H
|
||||
#define EVENTQUEUE_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
class EventQueue
|
||||
{
|
||||
public:
|
||||
bool EventQueue_AddEvent(int tInputCmd, void *pInputParam);
|
||||
bool EventQueue_AddEventToFront(int tInputCmd, void *pInputParam);
|
||||
bool EventQueue_PeekEvent(int *pOutputCmd, void **ppOutputParam);
|
||||
void EventQueue_PopEvent(void);
|
||||
bool EventQueue_GetEvent(int *pOutputCmd, void **ppOutputParam);
|
||||
|
||||
private:
|
||||
std::list<int> cmdList;
|
||||
std::list<void *> cmdParam;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user