Function

Gmtimeout_add_seconds_once_full

since: 0.0.1

[]

Declaration [src]

guint
gm_timeout_add_seconds_once_full (
  int priority,
  gulong seconds,
  GSourceOnceFunc function,
  gpointer data,
  GDestroyNotify notify
)
[]

Description [src]

Sets a function to be called after a timeout with priority priority. Correctly calculates the timeout even when the system is suspended in between.

This internally creates a main loop source using g_timeout_source_new_seconds() and attaches it to the main loop context using g_source_attach().

The timeout given is in terms of CLOCK_BOOTTIME time, it hence is also correct across suspend and resume. If that doesn’t matter use g_timeout_add_seconds_full 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

Changed in 0.3.0: Returns 0 when timer setup failed.

Available since: 0.0.1

This function is renamed to gm_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.
[]

Return value

Type: guint

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