Function

GLibtimeout_add_seconds

since: 2.14

Declaration [src]

guint
g_timeout_add_seconds (
  guint interval,
  GSourceFunc function,
  gpointer data
)

Description [src]

Sets a function to be called at regular intervals with the default priority, G_PRIORITY_DEFAULT.

The function is called repeatedly until it returns G_SOURCE_REMOVE or FALSE, at which point the timeout is automatically destroyed and the function will not be called again.

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(). You can do these steps manually if you need greater control. Also see g_timeout_add_seconds_full().

It is safe to call this function from any thread.

Note that the first call of the timer may not be precise for timeouts of one second. If you need finer precision and have such a timeout, you may want to use g_timeout_add() instead.

See mainloop memory management for details on how to handle the return value and memory management of data.

The interval given is in terms of monotonic time, not wall clock time. See g_get_monotonic_time().

Available since: 2.14

This function is not directly available to language bindings.

The implementation of this function is provided by g_timeout_add_seconds_full() in language bindings.

Parameters

interval

Type: guint

The time between calls to the function, in seconds.

function

Type: GSourceFunc

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.

Return value

Type: guint

The ID (greater than 0) of the event source.