io_thread: add function _timeout_add()

Same as _timeout_add_seconds(), but this one has millisecond
resolution.
This commit is contained in:
Max Kellermann 2011-09-20 21:26:59 +02:00
parent 2e83af7c21
commit 0c0400b6fc
2 changed files with 13 additions and 0 deletions

View File

@ -123,6 +123,15 @@ io_thread_idle_add(GSourceFunc function, gpointer data)
return id;
}
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)

View File

@ -62,6 +62,10 @@ io_thread_inside(void);
guint
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,