33 lines
553 B
C++
33 lines
553 B
C++
#ifndef A8_IOLOOP_H
|
|
#define A8_IOLOOP_H
|
|
|
|
#include <a8/a8.h>
|
|
#include <a8/types.h>
|
|
|
|
namespace a8
|
|
{
|
|
|
|
class IoLoop : public a8::Singleton<IoLoop>
|
|
{
|
|
private:
|
|
IoLoop() {};
|
|
friend class a8::Singleton<IoLoop>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
volatile int epoll_fd = a8::INVALID_FD;
|
|
|
|
private:
|
|
void WorkerThreadProc();
|
|
|
|
private:
|
|
int max_client_num_ = 1000;
|
|
volatile bool worker_thread_shutdown_ = false;
|
|
std::thread* worker_thread_ = nullptr;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|