aboutsummaryrefslogtreecommitdiff
path: root/src/InotifySource.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-15 18:18:02 +0100
committerMax Kellermann <max@duempel.org>2013-01-15 18:18:34 +0100
commit707112677065dd59f638764bb9dbd64d200b8a85 (patch)
tree10b5f2461c43fa5f847df23abccd9ada00e6b237 /src/InotifySource.hxx
parent2101daef5a939d41a306fcccf2d94992f82723e2 (diff)
InotifySource: use the SocketMonitor class
Diffstat (limited to 'src/InotifySource.hxx')
-rw-r--r--src/InotifySource.hxx23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/InotifySource.hxx b/src/InotifySource.hxx
index 6299d1e2..0f29ae75 100644
--- a/src/InotifySource.hxx
+++ b/src/InotifySource.hxx
@@ -20,29 +20,23 @@
#ifndef MPD_INOTIFY_SOURCE_HXX
#define MPD_INOTIFY_SOURCE_HXX
+#include "event/SocketMonitor.hxx"
#include "gerror.h"
+#include "gcc.h"
#include <glib.h>
typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask,
const char *name, void *ctx);
-class InotifySource {
+class InotifySource final : private SocketMonitor {
mpd_inotify_callback_t callback;
void *callback_ctx;
- int fd;
-
- GIOChannel *channel;
-
- /**
- * The channel's source id in the GLib main loop.
- */
- guint id;
-
struct fifo_buffer *buffer;
- InotifySource(mpd_inotify_callback_t callback, void *ctx, int fd);
+ InotifySource(EventLoop &_loop,
+ mpd_inotify_callback_t callback, void *ctx, int fd);
public:
/**
@@ -51,7 +45,8 @@ public:
*
* @param a callback invoked for events received from the kernel
*/
- static InotifySource *Create(mpd_inotify_callback_t callback,
+ static InotifySource *Create(EventLoop &_loop,
+ mpd_inotify_callback_t callback,
void *ctx,
GError **error_r);
@@ -73,9 +68,7 @@ public:
void Remove(unsigned wd);
private:
- void InEvent();
- static gboolean InEvent(GIOChannel *source, GIOCondition condition,
- gpointer data);
+ virtual void OnSocketReady(unsigned flags) override;
};
#endif