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
13f6b1b3
Commit
13f6b1b3
authored
Nov 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Remove: migrate from DeferredMonitor to DeferEvent
parent
593d82c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
Remove.cxx
src/db/update/Remove.cxx
+2
-2
Remove.hxx
src/db/update/Remove.hxx
+8
-5
No files found.
src/db/update/Remove.cxx
View file @
13f6b1b3
...
...
@@ -29,7 +29,7 @@
* available only there.
*/
void
UpdateRemoveService
::
RunDeferred
()
UpdateRemoveService
::
RunDeferred
()
noexcept
{
/* copy the list and unlock the mutex before invoking
callbacks */
...
...
@@ -65,5 +65,5 @@ UpdateRemoveService::Remove(std::string &&uri)
was empty; if it was not, then that even was already
pending */
if
(
was_empty
)
DeferredMonitor
::
Schedule
();
defer
.
Schedule
();
}
src/db/update/Remove.hxx
View file @
13f6b1b3
...
...
@@ -21,7 +21,7 @@
#define MPD_UPDATE_REMOVE_HXX
#include "check.h"
#include "event/Defer
redMonitor
.hxx"
#include "event/Defer
Event
.hxx"
#include "thread/Mutex.hxx"
#include "Compiler.h"
...
...
@@ -35,16 +35,19 @@ class DatabaseListener;
* This class handles #Song removal. It defers the action to the main
* thread to ensure that all references to the #Song are gone.
*/
class
UpdateRemoveService
final
:
DeferredMonitor
{
class
UpdateRemoveService
final
{
DatabaseListener
&
listener
;
Mutex
mutex
;
std
::
forward_list
<
std
::
string
>
uris
;
DeferEvent
defer
;
public
:
UpdateRemoveService
(
EventLoop
&
_loop
,
DatabaseListener
&
_listener
)
:
DeferredMonitor
(
_loop
),
listener
(
_listener
)
{}
:
listener
(
_listener
),
defer
(
_loop
,
BIND_THIS_METHOD
(
RunDeferred
))
{}
/**
* Sends a signal to the main thread which will in turn remove
...
...
@@ -55,8 +58,8 @@ public:
void
Remove
(
std
::
string
&&
uri
);
private
:
/*
virtual methods from class DeferredMonitor
*/
v
irtual
void
RunDeferred
()
override
;
/*
DeferEvent callback
*/
v
oid
RunDeferred
()
noexcept
;
};
#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