summaryrefslogtreecommitdiffstats
path: root/bus/loop.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-15 02:19:02 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-15 02:19:02 +0000
commit4c95a9782c65f88e2904c44abeb734a1b00f6353 (patch)
treed81b0c3a3497a031cb642dc5126750a36a6651ff /bus/loop.c
parentf468907fb09e8198c4cce7e8f2ddeae8b5476b9e (diff)
2003-03-14 Havoc Pennington <hp@redhat.com>
* dbus/dbus-memory.c: add a "detect buffer overwrites on free" cheesy hack * dbus/dbus-transport-debug.c: rework this a good bit to be less complicated. hopefully still works. * dbus/dbus-server-debug.c (handle_new_client): remove timeout manually * glib/dbus-gmain.c (timeout_handler): don't remove timeout after running it * dbus/dbus-message.c (dbus_message_copy): rename from dbus_message_new_from_message, fix it up to copy all the message fields, add test case * bus/dispatch.c (bus_dispatch_test): add some more test code, not quite passing yet
Diffstat (limited to 'bus/loop.c')
-rw-r--r--bus/loop.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/bus/loop.c b/bus/loop.c
index 72bf99e4..10614745 100644
--- a/bus/loop.c
+++ b/bus/loop.c
@@ -262,8 +262,8 @@ bus_loop_remove_timeout (DBusTimeout *timeout,
timeout, function, data);
}
-/* Returns TRUE if we dispatch any callbacks, which is just used in
- * test code as a debug hack
+/* Returns TRUE if we have any timeouts or ready file descriptors,
+ * which is just used in test code as a debug hack
*/
dbus_bool_t
@@ -283,7 +283,12 @@ bus_loop_iterate (dbus_bool_t block)
fds = NULL;
watches_for_fds = NULL;
-
+
+#if 0
+ _dbus_verbose (" iterate %d timeouts %d watches\n",
+ timeout_count, watch_count);
+#endif
+
if (callbacks == NULL)
{
bus_loop_quit ();
@@ -343,7 +348,9 @@ bus_loop_iterate (dbus_bool_t block)
{
unsigned long tv_sec;
unsigned long tv_usec;
-
+
+ retval = TRUE;
+
_dbus_get_current_time (&tv_sec, &tv_usec);
link = _dbus_list_get_first_link (&callbacks);
@@ -445,16 +452,23 @@ bus_loop_iterate (dbus_bool_t block)
(tv_sec - tcb->last_tv_sec) * 1000 +
(tv_usec - tcb->last_tv_usec) / 1000;
+#if 0
+ _dbus_verbose (" interval = %lu elapsed = %lu\n",
+ interval, elapsed);
+#endif
+
if (interval <= elapsed)
{
/* Save last callback time and fire this timeout */
tcb->last_tv_sec = tv_sec;
tcb->last_tv_usec = tv_usec;
-
+
+#if 0
+ _dbus_verbose (" invoking timeout\n");
+#endif
+
(* tcb->function) (tcb->timeout,
cb->data);
-
- retval = TRUE;
}
}
@@ -504,6 +518,7 @@ bus_loop_iterate (dbus_bool_t block)
(* wcb->function) (wcb->watch,
condition,
((Callback*)wcb)->data);
+
retval = TRUE;
}
}