25#ifndef __JOIN_REACTOR_HPP__
26#define __JOIN_REACTOR_HPP__
60 virtual int handle () const noexcept = 0;
condition variable class.
Definition condition.hpp:42
Event handler interface class.
Definition reactor.hpp:44
virtual void onError()
method called when an error occured on handle.
Definition reactor.hpp:82
virtual int handle() const noexcept=0
get native handle.
virtual void onClose()
method called when handle is closed.
Definition reactor.hpp:74
virtual ~EventHandler()=default
destroy instance.
EventHandler()=default
create instance.
virtual void onReceive()
method called when data are ready to be read on handle.
Definition reactor.hpp:66
Reactor class.
Definition reactor.hpp:95
Reactor(Reactor &&other)=delete
move constructor.
void dispatch()
dispatch events received.
Definition reactor.cpp:168
Reactor()
default constructor.
Definition reactor.cpp:44
int delHandler(EventHandler *handler)
delete handler from reactor.
Definition reactor.cpp:120
int addHandler(EventHandler *handler)
add handler to reactor.
Definition reactor.cpp:77
bool _running
status.
Definition reactor.hpp:175
int _epoll
epoll descriptor.
Definition reactor.hpp:163
static Reactor * instance()
create the Reactor instance.
Definition reactor.cpp:158
int _eventfd
eventfd descriptor.
Definition reactor.hpp:160
std::thread::id _threadId
thread id.
Definition reactor.hpp:166
Reactor & operator=(const Reactor &other)=delete
copy assignment operator.
~Reactor()
destroy instance.
Definition reactor.cpp:58
Reactor(const Reactor &other)=delete
copy constructor.
int _num
number of handlers.
Definition reactor.hpp:178
RecursiveMutex _mutex
protection mutex.
Definition reactor.hpp:169
Condition _threadStatus
thread status event.
Definition reactor.hpp:172
class used to protect shared data from being simultaneously accessed by multiple threads.
Definition mutex.hpp:106
Definition acceptor.hpp:32