Reactor

pembroke::Reactor

class pembroke::Reactor

Class representing the main event-loop.

See

pembroke::ReactorBuilder

See

pembroke::reactor()

Public Functions

Reactor(const ReactorBuilder &builder)

Construct a new reactor object given a builder containing configuration information.

See

pembroke::reactor()

See

pembroke::ReactorBuilder

Note

Throws and exception if the event-loop fails to construct, which would likely be a product of any custom configuration settings given. Unfortunately exact details are not available on which configuration caused the issue due to insufficient error reporting in libevent.

Parameters

auto run_blocking() const noexcept -> bool

Run the reactor in a blocking fashion and do not exit.

Note

In order to exit the event-loop, you will need to call pause() from an event in the reactor. You can continue in a blocking fashion by re-calling this method.

See

pause()

Return

True if the loop ran successfully, False otherwise

auto tick() const noexcept -> bool

Run the event-loop once. If there are no active events then this mehtod will return immediately. If there are active events, then tick() will wait for them to finish and execute the callbacks before returning.

Note

If you only want to execute ready-events, use tick_fast()

See

tick_fast()

Return

True if the loop ran successfully, False otherwise

auto tick_fast() const noexcept -> bool

Run the event-loop once, much like tick(). However this function will only execute the callbacks of events that are ready.

Note

Not all of the ready-events may be executed. To execute them all, use tick()

See

tick()

Return

True if the loop ran successfully, False otherwise

auto stop() const noexcept -> bool

Stop the reactor, returning control to the portion of code that invoked the blocking run (blocking_run()). If the reactor is not running, this function will have no success.

See

blocking_run()

Return

True if the reactor was successfully stopped (or if the reactor was not runnig), False if an error was encountered while attempting to stop.

pembroke::ReactorBuilder

struct ReactorBuilder

A simple builder/configurator for creating a Reactor.

See

Reactor

See

reactor