diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-25 12:37:01 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-06-13 16:25:33 +0100 |
commit | 0292b1a56d15759cb2d485b6134a332b20594a2e (patch) | |
tree | b57c611e185592516c6e2f97cfab1716e9197185 /dbus/dbus-watch.c | |
parent | 88bf20007b2dd82b9443782f824c66cccf943d04 (diff) | |
download | dbus-0292b1a56d15759cb2d485b6134a332b20594a2e.tar.gz |
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 <thiago@kde.org>
Diffstat (limited to 'dbus/dbus-watch.c')
-rw-r--r-- | dbus/dbus-watch.c | 14 |
1 files changed, 14 insertions, 0 deletions
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. |