D-Bus: DBusTimeout

D-Bus 1.14.0

Typedefs | Functions
DBusTimeout
D-Bus low-level public API

Object representing a timeout. More...

## Typedefs
typedef struct DBusTimeout | DBusTimeout
| Opaque object representing a timeout. More...

## Functions
DBUS_EXPORT int | dbus_timeout_get_interval (DBusTimeout *timeout)
| Gets the timeout interval. More...
DBUS_EXPORT void * | dbus_timeout_get_data (DBusTimeout *timeout)
| Gets data previously set with dbus_timeout_set_data() or NULL if none. More...
DBUS_EXPORT void | dbus_timeout_set_data (DBusTimeout *timeout, void *data, DBusFreeFunction free_data_function)
| Sets data which can be retrieved with dbus_timeout_get_data(). More...
DBUS_EXPORT dbus_bool_t | dbus_timeout_handle (DBusTimeout *timeout)
| Calls the timeout handler for this timeout. More...
DBUS_EXPORT dbus_bool_t | dbus_timeout_get_enabled (DBusTimeout *timeout)
| Returns whether a timeout is enabled or not. More...

## Detailed Description

Object representing a timeout.

Types and functions related to DBusTimeout. A timeout represents a timeout that the main loop needs to monitor, as in Qt's QTimer or GLib's g_timeout_add().

Use dbus_connection_set_timeout_functions() or dbus_server_set_timeout_functions() to be notified when libdbus needs to add or remove timeouts.

## Typedef Documentation

## ◆ DBusTimeout

DBusTimeout

Opaque object representing a timeout.

Definition at line 46 of file dbus-connection.h.

## Function Documentation

## ◆ dbus_timeout_get_data()

void * dbus_timeout_get_data | ( | DBusTimeout * | timeout | ) |

Gets data previously set with dbus_timeout_set_data() or NULL if none.

Parameters

  timeout | the DBusTimeout object.

Returns
  previously-set data.

Definition at line 455 of file dbus-timeout.c.

References data.

## ◆ dbus_timeout_get_enabled()

dbus_bool_t dbus_timeout_get_enabled | ( | DBusTimeout * | timeout | ) |

Returns whether a timeout is enabled or not.

If not enabled, it should not be polled by the main loop.

Parameters

  timeout | the DBusTimeout object

Returns
  TRUE if the timeout is enabled

Definition at line 512 of file dbus-timeout.c.

References enabled.

## ◆ dbus_timeout_get_interval()

int dbus_timeout_get_interval | ( | DBusTimeout * | timeout | ) |

Gets the timeout interval.

The dbus_timeout_handle() should be called each time this interval elapses, starting after it elapses once.

The interval may change during the life of the timeout; if so, the timeout will be disabled and re-enabled (calling the "timeout toggled function") to notify you of the change.

Parameters

  timeout | the DBusTimeout object.

Returns
  the interval in milliseconds.

Definition at line 442 of file dbus-timeout.c.

References interval.

## ◆ dbus_timeout_handle()

dbus_bool_t dbus_timeout_handle | ( | DBusTimeout * | timeout | ) |

Calls the timeout handler for this timeout.

This function should be called when the timeout occurs.

If this function returns FALSE, then there wasn't enough memory to handle the timeout. Typically just letting the timeout fire again next time it naturally times out is an adequate response to that problem, but you could try to do more if you wanted.

Parameters

  timeout | the DBusTimeout object.

Returns
  FALSE if there wasn't enough memory

Definition at line 498 of file dbus-timeout.c.

References handler, and handler_data.

## ◆ dbus_timeout_set_data()

void dbus_timeout_set_data | ( | DBusTimeout * | timeout,
|  | void * | data,
|  | DBusFreeFunction | free_data_function
| ) |  |

Sets data which can be retrieved with dbus_timeout_get_data().

Intended for use by the DBusAddTimeoutFunction and DBusRemoveTimeoutFunction to store their own data. For example with Qt you might store the QTimer for this timeout and with GLib you might store a g_timeout_add result id.

Parameters

  timeout | the DBusTimeout object.
  data | the data.
  free_data_function | function to be called to free the data.

Definition at line 472 of file dbus-timeout.c.

References data, free_data_function, and NULL.

Referenced by _dbus_timeout_unref().