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
0db7a0c9
Commit
0db7a0c9
authored
Nov 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Service: migrate from DeferredMonitor to DeferEvent
parent
13f6b1b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
Service.cxx
src/db/update/Service.cxx
+3
-3
Service.hxx
src/db/update/Service.hxx
+10
-4
No files found.
src/db/update/Service.cxx
View file @
0db7a0c9
...
...
@@ -40,7 +40,7 @@
UpdateService
::
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
CompositeStorage
&
_storage
,
DatabaseListener
&
_listener
)
:
DeferredMonitor
(
_loop
),
:
defer
(
_loop
,
BIND_THIS_METHOD
(
RunDeferred
)
),
db
(
_db
),
storage
(
_storage
),
listener
(
_listener
),
update_thread
(
BIND_THIS_METHOD
(
Task
))
...
...
@@ -136,7 +136,7 @@ UpdateService::Task()
else
LogDebug
(
update_domain
,
"finished"
);
DeferredMonitor
::
Schedule
();
defer
.
Schedule
();
}
void
...
...
@@ -237,7 +237,7 @@ UpdateService::Enqueue(const char *path, bool discard)
* Called in the main thread after the database update is finished.
*/
void
UpdateService
::
RunDeferred
()
UpdateService
::
RunDeferred
()
noexcept
{
assert
(
next
.
IsDefined
());
assert
(
walk
!=
nullptr
);
...
...
src/db/update/Service.hxx
View file @
0db7a0c9
...
...
@@ -22,7 +22,7 @@
#include "check.h"
#include "Queue.hxx"
#include "event/Defer
redMonitor
.hxx"
#include "event/Defer
Event
.hxx"
#include "thread/Thread.hxx"
#include "Compiler.h"
...
...
@@ -34,7 +34,9 @@ class CompositeStorage;
/**
* This class manages the update queue and runs the update thread.
*/
class
UpdateService
final
:
DeferredMonitor
{
class
UpdateService
final
{
DeferEvent
defer
;
SimpleDatabase
&
db
;
CompositeStorage
&
storage
;
...
...
@@ -61,6 +63,10 @@ public:
~
UpdateService
();
EventLoop
&
GetEventLoop
()
noexcept
{
return
defer
.
GetEventLoop
();
}
/**
* Returns a non-zero job id when we are currently updating
* the database.
...
...
@@ -93,8 +99,8 @@ public:
void
CancelMount
(
const
char
*
uri
);
private
:
/*
virtual methods from class DeferredMonitor
*/
v
irtual
void
RunDeferred
()
override
;
/*
DeferEvent callback
*/
v
oid
RunDeferred
()
noexcept
;
/* the update thread */
void
Task
();
...
...
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