typedef struct
{
- int refcount;
DBusTimeout *timeout;
unsigned long last_tv_sec;
unsigned long last_tv_usec;
return NULL;
cb->timeout = timeout;
- _dbus_get_current_time (&cb->last_tv_sec,
- &cb->last_tv_usec);
- cb->refcount = 1;
- return cb;
-}
-
-static TimeoutCallback *
-timeout_callback_ref (TimeoutCallback *cb)
-{
- _dbus_assert (cb->refcount > 0);
-
- cb->refcount += 1;
-
+ _dbus_get_monotonic_time (&cb->last_tv_sec,
+ &cb->last_tv_usec);
return cb;
}
static void
-timeout_callback_unref (TimeoutCallback *cb)
+timeout_callback_free (TimeoutCallback *cb)
{
- _dbus_assert (cb->refcount > 0);
-
- cb->refcount -= 1;
-
- if (cb->refcount == 0)
- {
- dbus_free (cb);
- }
+ dbus_free (cb);
}
static void
int fd)
{
DBusList *link;
- DBusList *next;
DBusList **watches;
_dbus_warn ("invalid request, socket fd %d not open\n", fd);
{
DBusList *link;
unsigned int flags = 0;
- dbus_bool_t interested;
+ dbus_bool_t interested = FALSE;
_dbus_assert (fd != -1);
}
else
{
- timeout_callback_unref (tcb);
+ timeout_callback_free (tcb);
return FALSE;
}
_dbus_list_remove_link (&loop->timeouts, link);
loop->callback_list_serial += 1;
loop->timeout_count -= 1;
- timeout_callback_unref (this);
+ timeout_callback_free (this);
return;
}
unsigned long tv_sec;
unsigned long tv_usec;
- _dbus_get_current_time (&tv_sec, &tv_usec);
+ _dbus_get_monotonic_time (&tv_sec, &tv_usec);
link = _dbus_list_get_first_link (&loop->timeouts);
while (link != NULL)
unsigned long tv_sec;
unsigned long tv_usec;
- _dbus_get_current_time (&tv_sec, &tv_usec);
+ _dbus_get_monotonic_time (&tv_sec, &tv_usec);
/* It'd be nice to avoid this O(n) thingy here */
link = _dbus_list_get_first_link (&loop->timeouts);