Commit dc531b64 authored by Max Kellermann's avatar Max Kellermann

db/update/InotifyQueue: migrate from TimeoutMonitor to TimerEvent

parent 91d4b5cf
......@@ -33,7 +33,7 @@ static constexpr std::chrono::steady_clock::duration INOTIFY_UPDATE_DELAY =
std::chrono::seconds(5);
void
InotifyQueue::OnTimeout()
InotifyQueue::OnDelay()
{
unsigned id;
......@@ -43,7 +43,7 @@ InotifyQueue::OnTimeout()
id = update.Enqueue(uri_utf8, false);
if (id == 0) {
/* retry later */
Schedule(INOTIFY_UPDATE_DELAY);
delay_event.Schedule(INOTIFY_UPDATE_DELAY);
return;
}
......@@ -69,7 +69,7 @@ path_in(const char *path, const char *possible_parent) noexcept
void
InotifyQueue::Enqueue(const char *uri_utf8)
{
Schedule(INOTIFY_UPDATE_DELAY);
delay_event.Schedule(INOTIFY_UPDATE_DELAY);
for (auto i = queue.begin(), end = queue.end(); i != end;) {
const char *current_uri = i->c_str();
......
......@@ -20,27 +20,29 @@
#ifndef MPD_INOTIFY_QUEUE_HXX
#define MPD_INOTIFY_QUEUE_HXX
#include "event/TimeoutMonitor.hxx"
#include "Compiler.h"
#include "event/TimerEvent.hxx"
#include <list>
#include <string>
class UpdateService;
class InotifyQueue final : private TimeoutMonitor {
class InotifyQueue final {
UpdateService &update;
std::list<std::string> queue;
TimerEvent delay_event;
public:
InotifyQueue(EventLoop &_loop, UpdateService &_update)
:TimeoutMonitor(_loop), update(_update) {}
:update(_update),
delay_event(_loop, BIND_THIS_METHOD(OnDelay)) {}
void Enqueue(const char *uri_utf8);
private:
virtual void OnTimeout() override;
void OnDelay();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment