Imported Upstream version 3.3.2
[debian/amanda] / common-src / event.c
index 474e87138107daae2079bedb0c2c646b446a3c7a..218d63872fbd0386d9fdf23e65af9f35aa40a3bc 100644 (file)
@@ -180,6 +180,8 @@ event_register(
 
            /* But it doesn't give us the source directly.. */
            handle->source = g_main_context_find_source_by_id(NULL, handle->source_id);
+           /* EV_TIME must always be handled after EV_READ */
+           g_source_set_priority(handle->source, 10);
            break;
 
        case EV_WAIT:
@@ -309,6 +311,7 @@ any_mainloop_events(void)
 
     for (iter = all_events; iter != NULL; iter = g_slist_next(iter)) {
        event_handle_t *hdl = (event_handle_t *)iter->data;
+       event_debug(2, _("list %p: %s/%jd\n"), hdl, event_type2str((hdl)->type), (hdl)->data);
        if (hdl->type != EV_WAIT)
            return TRUE;
     }
@@ -479,8 +482,12 @@ new_fdsource(gint fd, GIOCondition events)
  * exponentially increasing interals.  Writing a smarter implementation runs into
  * some tricky race conditions and extra machinery.  Since there are few, if any,
  * users of a glib version this old, such machinery wouldn't get much testing.
+ *
+ * FreeBSD users have also reported problems with the glib child watch source,
+ * so we use the dumb version on FreeBSD, too.
  */
-#if (GLIB_MAJOR_VERSION < 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 6))
+
+#if (defined(__FreeBSD__) || GLIB_MAJOR_VERSION < 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 6))
 typedef struct ChildWatchSource {
     GSource source; /* must be the first element in the struct */