diff options
author | Max Kellermann <max@duempel.org> | 2014-01-29 20:16:43 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-30 18:47:05 +0100 |
commit | c6725884bc155da431889468c86c546f0f64f9a1 (patch) | |
tree | 61d89751ecc98db9600620ac1788f32dea9214e1 /src/db/update/UpdateRemove.cxx | |
parent | a31738f6f1473f4f621bc16513ed0c6024749389 (diff) | |
download | mpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.gz mpd-c6725884bc155da431889468c86c546f0f64f9a1.tar.xz mpd-c6725884bc155da431889468c86c546f0f64f9a1.zip |
db/update: convert to OO API
Move global variables into the new classes. That may allow multiple
update threads for multiple databases one day.
Diffstat (limited to '')
-rw-r--r-- | src/db/update/Remove.cxx (renamed from src/db/update/UpdateRemove.cxx) | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/db/update/UpdateRemove.cxx b/src/db/update/Remove.cxx index c57758aef..e2c172a4b 100644 --- a/src/db/update/UpdateRemove.cxx +++ b/src/db/update/Remove.cxx @@ -18,7 +18,7 @@ */ #include "config.h" /* must be first for large file support */ -#include "UpdateRemove.hxx" +#include "Remove.hxx" #include "UpdateDomain.hxx" #include "GlobalEvents.hxx" #include "thread/Mutex.hxx" @@ -36,17 +36,12 @@ #include <assert.h> -static const Song *removed_song; - -static Mutex remove_mutex; -static Cond remove_cond; - /** * Safely remove a song from the database. This must be done in the * main task, to be sure that there is no pointer left to it. */ -static void -song_remove_event(void) +void +UpdateRemoveService::RunDeferred() { assert(removed_song != nullptr); @@ -74,19 +69,13 @@ song_remove_event(void) } void -update_remove_global_init(void) -{ - GlobalEvents::Register(GlobalEvents::DELETE, song_remove_event); -} - -void -update_remove_song(const Song *song) +UpdateRemoveService::Remove(const Song *song) { assert(removed_song == nullptr); removed_song = song; - GlobalEvents::Emit(GlobalEvents::DELETE); + DeferredMonitor::Schedule(); remove_mutex.lock(); |