Function

Gmwakeup_timeout_add_seconds_once_full

since: 0.3.0

Declaration [src]

guint
gm_wakeup_timeout_add_seconds_once_full (
  int priority,
  gulong seconds,
  GSourceOnceFunc function,
  gpointer data,
  GDestroyNotify notify,
  GError** error
)

Description [src]

Sets a function to be called after a timeout with the default priority, G_PRIORITY_DEFAULT. Correctly calculates the timeout even when the system is suspended in between. It will wake up the system when needed.

If the process doesn’t have enough permissions to wake the system creating the timer will fail. On Linux at least CAP_WAKE_ALARM capabilities are needed.

The timeout given is in terms of CLOCK_BOOTTIME_ALARM time, it hence is also correct across suspend and resume. If that doesn’t matter use g_timeout_add_seconds instead.

Note that glib’s g_timeout_add_seconds() doesn’t take system suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739.

Available since: 0.3.0

This function is renamed to gm_wakeup_timeout_add_seconds_once() in language bindings.

Parameters

priority

Type: int

The priority of the timeout source. Typically this will be in the range between G_PRIORITY_DEFAULT and G_PRIORITY_HIGH.

seconds

Type: gulong

The timeout in seconds.

function

Type: GSourceOnceFunc

Function to call.

data

Type: gpointer

Data to pass to function.

The argument can be NULL.
The data is owned by the caller of the function.
notify

Type: GDestroyNotify

Function to call when the timeout is removed, or NULL.

The argument can be NULL.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: guint

The ID (greater than 0) of the event source or 0 in case of error.