新增:实现 EventQueue 类,单线程事件队列

This commit is contained in:
2025-09-01 18:46:27 +08:00
commit 7b0d4fd2c3
9 changed files with 255 additions and 0 deletions

23
code/EventQueue.h Normal file
View 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