#include "inotify-kernel.h"
#include <sys/inotify.h>
+#include "glib-private.h"
+
/* Timings for pairing MOVED_TO / MOVED_FROM events */
#define PROCESS_EVENTS_TIME 1000 /* 1000 milliseconds (1 hz) */
#define DEFAULT_HOLD_UNTIL_TIME 0 /* 0 millisecond */
if (pending_count < MAX_PENDING_COUNT)
{
+ GSource *timeout_source;
unsigned int pending;
if (ioctl (inotify_instance_fd, FIONREAD, &pending) == -1)
ik_poll_fd_enabled = FALSE;
/* Set a timeout to re-add the PollFD to the source */
g_source_ref (source);
- g_timeout_add (TIMEOUT_MILLISECONDS, ik_source_timeout, source);
-
+
+ timeout_source = g_timeout_source_new (TIMEOUT_MILLISECONDS);
+ g_source_set_callback (timeout_source, ik_source_timeout, source, NULL);
+ g_source_attach (timeout_source, glib__private__ ()->g_get_worker_context ());
+ g_source_unref (timeout_source);
+
return FALSE;
}
g_source_set_name (source, "GIO Inotify");
g_source_add_poll (source, &ik_poll_fd);
g_source_set_callback (source, ik_read_callback, NULL, NULL);
- g_source_attach (source, NULL);
+ g_source_attach (source, glib__private__ ()->g_get_worker_context ());
g_source_unref (source);
cookie_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
/* If the event process callback is off, turn it back on */
if (!process_eq_running && events)
{
+ GSource *timeout_source;
+
process_eq_running = TRUE;
- g_timeout_add (PROCESS_EVENTS_TIME, ik_process_eq_callback, NULL);
+ timeout_source = g_timeout_source_new (PROCESS_EVENTS_TIME);
+ g_source_set_callback (timeout_source, ik_process_eq_callback, NULL, NULL);
+ g_source_attach (timeout_source, glib__private__ ()->g_get_worker_context ());
+ g_source_unref (timeout_source);
}
G_UNLOCK (inotify_lock);
#include <glib.h>
#include "inotify-missing.h"
#include "inotify-path.h"
+#include "glib-private.h"
#define SCAN_MISSING_TIME 4 /* 1/4 Hz */
/* If the timeout is turned off, we turn it back on */
if (!scan_missing_running)
{
+ GSource *source;
+
scan_missing_running = TRUE;
- g_timeout_add_seconds (SCAN_MISSING_TIME, im_scan_missing, NULL);
+ source = g_timeout_source_new_seconds (SCAN_MISSING_TIME);
+ g_source_set_callback (source, im_scan_missing, NULL, NULL);
+ g_source_attach (source, glib__private__ ()->g_get_worker_context ());
+ g_source_unref (source);
}
}