join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Reactor Class Reference

Reactor class. More...

#include <reactor.hpp>

Collaboration diagram for join::Reactor:

Public Member Functions

 Reactor ()
 default constructor.
 
 Reactor (const Reactor &other)=delete
 copy constructor.
 
 Reactor (Reactor &&other)=delete
 move constructor.
 
Reactoroperator= (const Reactor &other)=delete
 copy assignment operator.
 
Reactoroperator= (Reactor &&other)=delete
 move assignment operator.
 
 ~Reactor ()
 destroy instance.
 
int addHandler (EventHandler *handler)
 add handler to reactor.
 
int delHandler (EventHandler *handler)
 delete handler from reactor.
 

Static Public Member Functions

static Reactorinstance ()
 create the Reactor instance.
 

Protected Member Functions

void dispatch ()
 dispatch events received.
 

Protected Attributes

int _eventfd = -1
 eventfd descriptor.
 
int _epoll = -1
 epoll descriptor.
 
std::thread::id _threadId
 thread id.
 
RecursiveMutex _mutex
 protection mutex.
 
Condition _threadStatus
 thread status event.
 
bool _running = false
 status.
 
int _num = 0
 number of handlers.
 

Detailed Description

Reactor class.

Constructor & Destructor Documentation

◆ Reactor() [1/3]

Reactor::Reactor ( )

default constructor.

◆ Reactor() [2/3]

join::Reactor::Reactor ( const Reactor & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ Reactor() [3/3]

join::Reactor::Reactor ( Reactor && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~Reactor()

Reactor::~Reactor ( )

destroy instance.

Member Function Documentation

◆ addHandler()

int Reactor::addHandler ( EventHandler * handler)

add handler to reactor.

Parameters
handlerhandler pointer.
Returns
0 on success, -1 on failure.

◆ delHandler()

int Reactor::delHandler ( EventHandler * handler)

delete handler from reactor.

Parameters
handlerhandler pointer.
Returns
0 on success, -1 on failure.

◆ dispatch()

void Reactor::dispatch ( )
protected

dispatch events received.

◆ instance()

Reactor * Reactor::instance ( )
static

create the Reactor instance.

Returns
Reactor instance pointer.

◆ operator=() [1/2]

Reactor & join::Reactor::operator= ( const Reactor & other)
delete

copy assignment operator.

Parameters
otherother object to copy.
Returns
current object.

◆ operator=() [2/2]

Reactor & join::Reactor::operator= ( Reactor && other)
delete

move assignment operator.

Parameters
otherother object to move.
Returns
current object.

Member Data Documentation

◆ _epoll

int join::Reactor::_epoll = -1
protected

epoll descriptor.

◆ _eventfd

int join::Reactor::_eventfd = -1
protected

eventfd descriptor.

◆ _mutex

RecursiveMutex join::Reactor::_mutex
protected

protection mutex.

◆ _num

int join::Reactor::_num = 0
protected

number of handlers.

◆ _running

bool join::Reactor::_running = false
protected

status.

◆ _threadId

std::thread::id join::Reactor::_threadId
protected

thread id.

◆ _threadStatus

Condition join::Reactor::_threadStatus
protected

thread status event.


The documentation for this class was generated from the following files: