Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
dc531b64
Commit
dc531b64
authored
Aug 29, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/InotifyQueue: migrate from TimeoutMonitor to TimerEvent
parent
91d4b5cf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
InotifyQueue.cxx
src/db/update/InotifyQueue.cxx
+3
-3
InotifyQueue.hxx
src/db/update/InotifyQueue.hxx
+7
-5
No files found.
src/db/update/InotifyQueue.cxx
View file @
dc531b64
...
...
@@ -33,7 +33,7 @@ static constexpr std::chrono::steady_clock::duration INOTIFY_UPDATE_DELAY =
std
::
chrono
::
seconds
(
5
);
void
InotifyQueue
::
On
Timeout
()
InotifyQueue
::
On
Delay
()
{
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
();
...
...
src/db/update/InotifyQueue.hxx
View file @
dc531b64
...
...
@@ -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
:
v
irtual
void
OnTimeout
()
override
;
v
oid
OnDelay
()
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment