MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

InotifySource.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_INOTIFY_SOURCE_HXX
21 #define MPD_INOTIFY_SOURCE_HXX
22
23 #include "event/SocketMonitor.hxx"
24 #include "Compiler.h"
25
26 class FileDescriptor;
27
28 typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask,
29 const char *name, void *ctx);
30
31 class InotifySource final : private SocketMonitor {
32 mpd_inotify_callback_t callback;
33 void *callback_ctx;
34
35 public:
45 InotifySource(EventLoop &_loop,
46 mpd_inotify_callback_t callback, void *ctx);
47
48 ~InotifySource() {
49 Close();
50 }
51
59 int Add(const char *path_fs, unsigned mask);
60
66 void Remove(unsigned wd);
67
68 private:
69 virtual bool OnSocketReady(unsigned flags) override;
70 };
71
72 #endif
mpd_inotify_callback_t
void(* mpd_inotify_callback_t)(int wd, unsigned mask, const char *name, void *ctx)
Definition: InotifySource.hxx:28
EventLoop
An event loop that polls for events on file/socket descriptors.
Definition: Loop.hxx:51
SocketMonitor.hxx
Compiler.h
InotifySource::~InotifySource
~InotifySource()
Definition: InotifySource.hxx:48
SocketMonitor
Monitor events on a socket.
Definition: SocketMonitor.hxx:54
InotifySource::InotifySource
InotifySource(EventLoop &_loop, mpd_inotify_callback_t callback, void *ctx)
Creates a new inotify source and registers it in the EventLoop.
InotifySource::Add
int Add(const char *path_fs, unsigned mask)
Adds a path to the notify list.
FileDescriptor
An OO wrapper for a UNIX file descriptor.
Definition: FileDescriptor.hxx:49
SocketMonitor::Close
void Close()
InotifySource::Remove
void Remove(unsigned wd)
Removes a path from the notify list.
InotifySource
Definition: InotifySource.hxx:31
name
const Partition const char * name
Definition: Count.hxx:34