Loading of the recommendation engine now controlled by scanner. Bonus: better control/reporting

This commit is contained in:
emeric
2020-10-28 17:40:15 +01:00
parent c9d138a96b
commit 438e99f5c2
31 changed files with 454 additions and 469 deletions
@@ -1,58 +0,0 @@
/*
* Copyright (C) 2020 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <mutex>
#include <condition_variable>
class Semaphore
{
public:
Semaphore() = default;
Semaphore(const Semaphore&) = delete;
Semaphore(Semaphore&&) = delete;
Semaphore& operator=(const Semaphore&) = delete;
Semaphore& operator=(Semaphore&&) = delete;
void notify()
{
std::unique_lock<std::mutex> lock {_mutex};
_count++;
_cv.notify_one();
}
void wait()
{
std::unique_lock<std::mutex> lock(_mutex);
while (_count == 0)
_cv.wait(lock);
_count--;
}
private:
std::mutex _mutex;
std::condition_variable _cv;
unsigned _count {};
};
+5
View File
@@ -46,6 +46,11 @@ class Service
return Service<Class>::get();
}
Class& operator*() const
{
return *Service<Class>::get();
}
static Class* get() { return _service.get(); }
private: