From 0292b1a56d15759cb2d485b6134a332b20594a2e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 25 Jan 2011 12:37:01 +0000 Subject: DBusLoop: move OOM flag in watches inside the DBusWatch This will eventually let us maintain a DBusPollFD[] of just the active watches, between several iterations. The more immediate benefit is that WatchCallback can go away, because it only contains a refcount, a now-useless type, and a watch that already has its own refcount. This doesn't take any more memory for DBusWatch when not using DBusLoop (e.g. in client/service code or bindings), because we're just using more bits in an existing bitfield. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342 Reviewed-by: Thiago Macieira --- dbus/dbus-watch.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'dbus/dbus-watch.c') diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index f4a5820e..b9f4ac23 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -50,6 +50,7 @@ struct DBusWatch void *data; /**< Application data. */ DBusFreeFunction free_data_function; /**< Free the application data. */ unsigned int enabled : 1; /**< Whether it's enabled. */ + unsigned int oom_last_time : 1; /**< Whether it was OOM last time. */ }; dbus_bool_t @@ -58,6 +59,19 @@ _dbus_watch_get_enabled (DBusWatch *watch) return watch->enabled; } +dbus_bool_t +_dbus_watch_get_oom_last_time (DBusWatch *watch) +{ + return watch->oom_last_time; +} + +void +_dbus_watch_set_oom_last_time (DBusWatch *watch, + dbus_bool_t oom) +{ + watch->oom_last_time = oom; +} + /** * Creates a new DBusWatch. Used to add a file descriptor to be polled * by a main loop. -- cgit v1.2.1