sdbus-c++ 1.6.0
High-level C++ D-Bus library based on systemd D-Bus implementation
Loading...
Searching...
No Matches
sdbus::IConnection::PollData Struct Reference

#include <IConnection.h>

Public Member Functions

std::chrono::microseconds getAbsoluteTimeout () const
std::optional< std::chrono::microseconds > getRelativeTimeout () const
int getPollTimeout () const

Public Attributes

int fd
short int events
uint64_t timeout_usec

Detailed Description

Poll Data for external event loop implementations.

To integrate sdbus with your app's own custom event handling system you can use this method to query which file descriptors, poll events and timeouts you should add to your app's poll(2), or select(2) call in your main event loop.

If you are unsure what this all means then use enterEventLoop() or enterEventLoopAsync() instead.

See: getEventLoopPollData()

Member Function Documentation

◆ getAbsoluteTimeout()

std::chrono::microseconds sdbus::IConnection::PollData::getAbsoluteTimeout ( ) const
inlinenodiscard

Get the event poll timeout.

The timeout is an absolute value based of CLOCK_MONOTONIC.

Returns
a duration since the CLOCK_MONOTONIC epoch started.

◆ getPollTimeout()

int sdbus::IConnection::PollData::getPollTimeout ( ) const
nodiscard

Get a converted, relative timeout which can be passed as argument 'timeout' to poll(2)

Returns
-1 if the timeout is indefinite. 0 if the poll(2) shouldn't block. An integer in milli seconds otherwise.

◆ getRelativeTimeout()

std::optional< std::chrono::microseconds > sdbus::IConnection::PollData::getRelativeTimeout ( ) const
nodiscard

Get the timeout as relative value from now

Returns
std::nullopt if the timeout is indefinite. A duration otherwise.

Member Data Documentation

◆ events

short int sdbus::IConnection::PollData::events

The events to use for poll(2) alongside fd.

◆ fd

int sdbus::IConnection::PollData::fd

The read fd to be monitored by the event loop.

◆ timeout_usec

uint64_t sdbus::IConnection::PollData::timeout_usec

Absolute timeout value in micro seconds and based of CLOCK_MONOTONIC.


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