mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Oops, put the thread pool semaphore back in the main indexer.
This commit is contained in:
parent
7418ba5b18
commit
2e3f62e225
@ -102,7 +102,8 @@ Indexer::Indexer(const std::string& libraryPath, const std::string& dbFilename)
|
||||
, tracksScanned(0)
|
||||
, exit(false)
|
||||
, state(StateIdle)
|
||||
, prefs(Preferences::ForComponent(prefs::components::Settings)) {
|
||||
, prefs(Preferences::ForComponent(prefs::components::Settings))
|
||||
, readSemaphore(prefs->GetInt(prefs::keys::MaxTagReadThreads, MAX_THREADS)) {
|
||||
this->metadataReaders = PluginFactory::Instance()
|
||||
.QueryInterface<IMetadataReader, MetadataDeleter>("GetMetadataReader");
|
||||
|
||||
@ -395,6 +396,10 @@ void Indexer::ReadMetadataFromFile(
|
||||
}
|
||||
|
||||
this->IncrementTracksScanned();
|
||||
|
||||
#ifdef MULTI_THREADED_INDEXER
|
||||
this->readSemaphore.post();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void Indexer::IncrementTracksScanned(size_t delta) {
|
||||
@ -444,6 +449,8 @@ void Indexer::SyncDirectory(
|
||||
}
|
||||
else {
|
||||
if (io) {
|
||||
this->readSemaphore.wait();
|
||||
|
||||
io->post(boost::bind(
|
||||
&Indexer::ReadMetadataFromFile,
|
||||
this,
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
|
||||
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
@ -156,6 +157,7 @@ namespace musik { namespace core {
|
||||
std::shared_ptr<musik::core::db::ScopedTransaction> trackTransaction;
|
||||
std::vector<std::string> paths;
|
||||
std::shared_ptr<musik::core::sdk::IIndexerSource> currentSource;
|
||||
boost::interprocess::interprocess_semaphore readSemaphore;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Indexer> IndexerPtr;
|
||||
|
Loading…
Reference in New Issue
Block a user