From 707112677065dd59f638764bb9dbd64d200b8a85 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Jan 2013 18:18:02 +0100 Subject: InotifySource: use the SocketMonitor class --- src/InotifySource.hxx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/InotifySource.hxx') 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 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 -- cgit v1.2.3