libcommonc++  0.7
AsyncIOPoller Class Reference

A class that polls a set of AsyncIOTask objects. More...

#include <AsyncIOPoller.h++>

Public Member Functions

 AsyncIOPoller ()
 Construct a new AsyncIOPoller. More...
 
 ~AsyncIOPoller ()
 Destructor. More...
 
void addTask (AsyncIOTask *task)
 Register the specified AsyncIOTask with this poller. More...
 
void removeTask (AsyncIOTask *task)
 Unregister the specified AsyncIOTask from this poller. More...
 
void removeAllTasks ()
 Unregister all AsyncIOTask objects from this poller. More...
 
uint_t getTaskCount () const
 Get the number of tasks currently registered with this poller. More...
 
bool poll (timespan_ms_t timeout=0)
 Poll the AsyncIOTask objects registered with this poller. More...
 

Detailed Description

A class that polls a set of AsyncIOTask objects.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ AsyncIOPoller()

Construct a new AsyncIOPoller.

◆ ~AsyncIOPoller()

Destructor.

Member Function Documentation

◆ addTask()

void addTask ( AsyncIOTask task)

Register the specified AsyncIOTask with this poller.

The poller does not take ownership of the AsyncIOTask object.

Parameters
taskThe task to register.

◆ getTaskCount()

uint_t getTaskCount ( ) const

Get the number of tasks currently registered with this poller.

◆ poll()

bool poll ( timespan_ms_t  timeout = 0)

Poll the AsyncIOTask objects registered with this poller.

The call blocks until at least one of the tasks is completed, or the timeout interval passes, whichever occurs first. There is no userspace latency imposed by this call.

Parameters
timeoutThe timeout, in milliseconds. Negative values are interpreted as an infinite timeout.
Returns
true if at least one of the asynchronous I/O tasks registered with this poller has completed, false otherwise.

◆ removeAllTasks()

void removeAllTasks ( )

Unregister all AsyncIOTask objects from this poller.

◆ removeTask()

void removeTask ( AsyncIOTask task)

Unregister the specified AsyncIOTask from this poller.

Parameters
taskThe task to unregister.

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