Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Types | Public Member Functions | List of all members
plasma::EventLoop Class Reference

#include <plasma/events.h>

Public Types

using FileCallback = std::function< void(int)>
 
using TimerCallback = std::function< int(int64_t)>
 

Public Member Functions

 EventLoop ()
 
bool AddFileEvent (int fd, int events, const FileCallback &callback)
 Add a new file event handler to the event loop. More...
 
void RemoveFileEvent (int fd)
 Remove a file event handler from the event loop. More...
 
int64_t AddTimer (int64_t timeout, const TimerCallback &callback)
 Register a handler that will be called after a time slice of "timeout" milliseconds. More...
 
int RemoveTimer (int64_t timer_id)
 Remove a timer handler from the event loop. More...
 
void Start ()
 Run the event loop. More...
 
void Stop ()
 Stop the event loop. More...
 

Member Typedef Documentation

◆ FileCallback

using plasma::EventLoop::FileCallback = std::function<void(int)>

◆ TimerCallback

using plasma::EventLoop::TimerCallback = std::function<int(int64_t)>

Constructor & Destructor Documentation

◆ EventLoop()

plasma::EventLoop::EventLoop ( )

Member Function Documentation

◆ AddFileEvent()

bool plasma::EventLoop::AddFileEvent ( int  fd,
int  events,
const FileCallback callback 
)

Add a new file event handler to the event loop.

Parameters
fdThe file descriptor we are listening to.
eventsThe flags for events we are listening to (read or write).
callbackThe callback that will be called when the event happens.
Returns
Returns true if the event handler was added successfully.

◆ AddTimer()

int64_t plasma::EventLoop::AddTimer ( int64_t  timeout,
const TimerCallback callback 
)

Register a handler that will be called after a time slice of "timeout" milliseconds.

Parameters
timeoutThe timeout in milliseconds.
callbackThe callback for the timeout.
Returns
The ID of the newly created timer.

◆ RemoveFileEvent()

void plasma::EventLoop::RemoveFileEvent ( int  fd)

Remove a file event handler from the event loop.

Parameters
fdThe file descriptor of the event handler.

◆ RemoveTimer()

int plasma::EventLoop::RemoveTimer ( int64_t  timer_id)

Remove a timer handler from the event loop.

Parameters
timer_idThe ID of the timer that is to be removed.
Returns
The ae.c error code. TODO(pcm): needs to be standardized

◆ Start()

void plasma::EventLoop::Start ( )

Run the event loop.

◆ Stop()

void plasma::EventLoop::Stop ( )

Stop the event loop.


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