Commit 0c0400b6 authored by Max Kellermann's avatar Max Kellermann

io_thread: add function _timeout_add()

Same as _timeout_add_seconds(), but this one has millisecond resolution.
parent 2e83af7c
......@@ -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)
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment