Timeout.addSeconds

Sets a function to be called at regular intervals with the default priority, G_PRIORITY_DEFAULT The function is called repeatedly until it returns 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 Timeout.sourceNewSeconds and attaches it to the main loop context using Source.attach. You can do these steps manually if you need greater control. Also see Timeout.addSecondsFull.

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 Timeout.add instead.

See [memory management of sources][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().

class Timeout
static
uint
addSeconds

Parameters

interval uint

the time between calls to the function, in seconds

function_ GSourceFunc

function to call

data void*

data to pass to function

Return Value

Type: uint

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

Meta

Since

2.14