libkeepalive
|
Provides suspend aware timers with glib timeout compatible API. More...
#include <glib.h>
Go to the source code of this file.
Functions | |
guint | keepalive_timeout_add_full (gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify) |
guint | keepalive_timeout_add (guint interval, GSourceFunc function, gpointer data) |
guint | keepalive_timeout_add_seconds_full (gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify) |
guint | keepalive_timeout_add_seconds (guint interval, GSourceFunc function, gpointer data) |
Provides suspend aware timers with glib timeout compatible API.
guint keepalive_timeout_add_full | ( | gint | priority, |
guint | interval, | ||
GSourceFunc | function, | ||
gpointer | data, | ||
GDestroyNotify | notify ) |
Drop in replacement for g_timeout_add_full()
Unlike normal glib timers, these can wake the device from suspend and keep the device from suspending while the callback function is executed by using IPHB wakeups from DSME and CPU-keepalive from MCE.
Note that the wakeup time is not exact.
The IPHB wakeups use 1 second resolution, so the milliseconds used due to following the glib interface are rounded up to the next full second.
If the device needs to wake up from suspend, that happens via RTC alarm interrupts. In that case clock source differences can cause up to one second jitter in wakeups.
And the triggering is scheduled via ranged IPHB wakeup. By default the range that is used is [interval, interval + heartbeat seconds] - which should guarantee that the device will not wake up solely to serve the timer, but also means the wakeup can occur up to 12 seconds later than requested.
If more exact wakeup is absolutely required, the priority parameter of G_PRIORITY_HIGH can be used and the wakeup is scheduled to occur at range of [interval, interval + 1 second].
priority | the priority of the timeout source. Typically this will be in the range between G_PRIORITY_DEFAULT and G_PRIORITY_HIGH. |
interval | the time between calls to the function, in milliseconds |
function | function to call |
data | data to pass to function |
notify | function to call when the timeout is removed, or NULL. |
guint keepalive_timeout_add | ( | guint | interval, |
GSourceFunc | function, | ||
gpointer | data ) |
Drop in replacement for g_timeout_add()
See keepalive_timeout_add_full() for details.
interval | the time between calls to the function, in milliseconds |
function | function to call |
data | data to pass to function |
guint keepalive_timeout_add_seconds_full | ( | gint | priority, |
guint | interval, | ||
GSourceFunc | function, | ||
gpointer | data, | ||
GDestroyNotify | notify ) |
Drop in replacement for g_timeout_add_seconds_full()
See keepalive_timeout_add_full() for details.
priority | the priority of the timeout source. Typically this will be in the range between G_PRIORITY_DEFAULT and G_PRIORITY_HIGH. |
interval | the time between calls to the function, in seconds |
function | function to call |
data | data to pass to function |
notify | function to call when the timeout is removed, or NULL. |
guint keepalive_timeout_add_seconds | ( | guint | interval, |
GSourceFunc | function, | ||
gpointer | data ) |
Drop in replacement for g_timeout_add_seconds()
See keepalive_timeout_add_full() for details.
interval | the time between calls to the function, in seconds |
function | function to call |
data | data to pass to function |