2
3
4
5
9#include "../InetAddress.h"
16
17
22
23
34
35
36
40
41
45
46
47
51
52
53
57
58
59
60
61 virtual void Poll(
int timeoutMs, ChannelList* activeChannels) = 0;
64
65
66
70
71
72
76
77
78
79
83
84
85
86
92
93
99
100
#define SPICES_PROFILE_ZONE
Wrapper of SOCKET'S Event.
virtual ~EventLoopThreadWrapper()
Destructor Function.
static EventLoop *& GetInst(InetAddress *address=nullptr)
Get EventLoop Instance. @reutrn Returns EventLoop Instance.
EventLoop * instance
This thread EventLoop instance.
Wrapper of Instance/Delete ThreadCache in thread.
void HandleWakeUp()
Handle WakeUp notify by read one byte data.
void DoPendingFunctors()
Execute all pending functors.
bool HasChannel(Channel *channel) const
Determine if channel is inside poller.
EventLoop(InetAddress *address=nullptr)
Constructor Function.
void WakeUp()
WakeUp a thread, which wait on recv, by sending one byte data.
void Loop()
Start Event Loop.
bool IsInLoopThread() const
Determine if current thread is in eventloop thread.
void RunInLoop(Functor cb)
Push functor to pending functors.
~EventLoop()
Destructor Function.
void QueueInLoop(Functor cb)
Execute functor in EventLoop thread.
void UpdateChannel(Channel *channel) const
Update channel state with poller.
void Quit()
Quit from Event Loop.
void RemoveChannel(Channel *channel) const
Remove channel from poller.
Wrapper of Poller and wakeup socket to acceptor(SubLoop).
This class is Wrapper of current socket address.
virtual void RemoveChannel(Channel *channel)=0
Remove Channel and Update Poll.
virtual void Poll(int timeoutMs, ChannelList *activeChannels)=0
Poll events on EventList.
virtual ~Poller()=default
Destructor Function.
ChannelMap m_Channels
This Poller interested Channels.
static std::shared_ptr< Poller > DefaultPoller(EventLoop *loop)
Create Default Poller.
EventLoop * m_Loop
This Poller interested EventLoop.
bool HasChannel(Channel *channel) const
Determine if channel is in ChannelMap.
virtual void UpdateChannel(Channel *channel)=0
Update Channel and Update Poll.
Poller(EventLoop *loop)
Constructor Function.
Poller & operator=(const Poller &)=delete
Copy Assignment Operation.
Poller(const Poller &)=delete
Copy Constructor Function.
Inherit from this and Implement Specific Poller.
constexpr uint32_t pollTimeoutMs
Poller timeout. Default is 10s.