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

Reactor class. More...

#include <reactor.hpp>

Public Member Functions

 Reactor ()
 default constructor.
 
 Reactor (const Reactor &other)=delete
 copy constructor.
 
Reactoroperator= (const Reactor &other)=delete
 copy assignment operator.
 
 Reactor (Reactor &&other)=delete
 move constructor.
 
Reactoroperator= (Reactor &&other)=delete
 move assignment operator.
 
 ~Reactor () noexcept
 destroy instance.
 
int addHandler (int fd, EventHandler *handler, bool sync=true) noexcept
 add handler to reactor.
 
int delHandler (int fd, bool sync=true) noexcept
 delete handler from reactor.
 
void run ()
 run the event loop (blocking).
 
void stop (bool sync=true) noexcept
 stop the event loop.
 
int mlock () const noexcept
 lock command queue memory in RAM.
 
bool isReactorThread () const noexcept
 check if the calling thread is the reactor thread.
 

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 ( )
noexcept

destroy instance.

Member Function Documentation

◆ addHandler()

int Reactor::addHandler ( int fd,
EventHandler * handler,
bool sync = true )
noexcept

add handler to reactor.

Parameters
fdfile descriptor.
handlerhandler pointer.
syncwait for operation completion if true.
Returns
0 on success, -1 on failure.

◆ delHandler()

int Reactor::delHandler ( int fd,
bool sync = true )
noexcept

delete handler from reactor.

Parameters
fdfile descriptor.
syncwait for operation completion if true.
Returns
0 on success, -1 on failure.

◆ isReactorThread()

bool Reactor::isReactorThread ( ) const
noexcept

check if the calling thread is the reactor thread.

Returns
true if called from the reactor thread.

◆ mlock()

int Reactor::mlock ( ) const
noexcept

lock command queue memory in RAM.

Returns
0 on success, -1 on failure.

◆ 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.

◆ run()

void Reactor::run ( )

run the event loop (blocking).

◆ stop()

void Reactor::stop ( bool sync = true)
noexcept

stop the event loop.

Parameters
syncwait for loop termination if true.

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