aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/io_thread.c9
-rw-r--r--src/io_thread.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/src/io_thread.c b/src/io_thread.c
index 501cfe50a..ffa513d49 100644
--- a/src/io_thread.c
+++ b/src/io_thread.c
@@ -124,6 +124,15 @@ io_thread_idle_add(GSourceFunc function, gpointer data)
}
GSource *
+io_thread_timeout_add(guint interval_ms, GSourceFunc function, gpointer data)
+{
+ GSource *source = g_timeout_source_new(interval_ms);
+ g_source_set_callback(source, function, data, NULL);
+ g_source_attach(source, io.context);
+ return source;
+}
+
+GSource *
io_thread_timeout_add_seconds(guint interval,
GSourceFunc function, gpointer data)
{
diff --git a/src/io_thread.h b/src/io_thread.h
index d1a203aa3..8ff5a71e5 100644
--- a/src/io_thread.h
+++ b/src/io_thread.h
@@ -64,6 +64,10 @@ io_thread_idle_add(GSourceFunc function, gpointer data);
G_GNUC_MALLOC
GSource *
+io_thread_timeout_add(guint interval_ms, GSourceFunc function, gpointer data);
+
+G_GNUC_MALLOC
+GSource *
io_thread_timeout_add_seconds(guint interval,
GSourceFunc function, gpointer data);