23 #ifndef AI_IPC_DBUSWATCHES_H
24 #define AI_IPC_DBUSWATCHES_H
29 #include <sys/epoll.h>
31 #include <dbus/dbus.h>
75 static dbus_bool_t addWatchCb(DBusWatch *watch,
void *userData);
76 static void toggleWatchCb(DBusWatch *watch,
void *userData);
77 static void removeWatchCb(DBusWatch *watch,
void *userData);
79 dbus_bool_t
addWatch(DBusWatch *watch);
83 uint64_t
createWatch(DBusWatch *watch,
int duppedFd);
87 DBusConnection*
const mDbusConnection;
91 static const unsigned mMaxWatches = 128;
104 struct epoll_event mEpollEvents[mMaxWatches];
106 #if (AI_BUILD_TYPE == AI_DEBUG)
108 const std::thread::id mExpectedThreadId;
Utility object to handle installing / removing dbus watches from the poll loop.
Definition: DbusWatches.h:65
void toggleWatch(DBusWatch *watch)
Toggles the watch flags on the given watch.
Definition: DbusWatches.cpp:441
void processEvent(unsigned int pollEvents)
Called when something has happened on the epoll event loop.
Definition: DbusWatches.cpp:144
dbus_bool_t addWatch(DBusWatch *watch)
Callback from dbus to add a new watch to poll on.
Definition: DbusWatches.cpp:300
void removeWatch(DBusWatch *watch)
Removes the watch from the epoll loop and our local array.
Definition: DbusWatches.cpp:387
uint64_t createWatch(DBusWatch *watch, int duppedFd)
Tries to find a slot to put the watch into.
Definition: DbusWatches.cpp:223
void deleteWatch(uint64_t tag)
Removes a watch from our internal array.
Definition: DbusWatches.cpp:254
int fd() const
Returns the epoll fd that the dispatcher should poll on.
Definition: DbusWatches.cpp:129
Definition: DbusWatches.h:95