WIP. Using WIOService to handle Services
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "DatabaseUpdateService.hpp"
|
||||
|
||||
DatabaseUpdateService::DatabaseUpdateService(boost::asio::io_service& ioService, const boost::filesystem::path& p)
|
||||
DatabaseUpdateService::DatabaseUpdateService(const boost::filesystem::path& p)
|
||||
: _metadataParser(),
|
||||
_databaseUpdater( p, _metadataParser)
|
||||
{
|
||||
@@ -11,18 +11,14 @@ DatabaseUpdateService::DatabaseUpdateService(boost::asio::io_service& ioService,
|
||||
void
|
||||
DatabaseUpdateService::start(void)
|
||||
{
|
||||
// TODO
|
||||
// Read database parameters and program a timer for the next scan
|
||||
// _thread = boost::thread(boost::bind(&DatabaseUpdater::Updater::process, &_databaseUpdater));
|
||||
_databaseUpdater.start();
|
||||
}
|
||||
|
||||
void
|
||||
DatabaseUpdateService::stop(void)
|
||||
{
|
||||
std::cout << "DatabaseUpdateService::stop, processing..." << std::endl;
|
||||
// no effect if thread does not exist
|
||||
_thread.interrupt();
|
||||
_thread.join();
|
||||
_databaseUpdater.stop();
|
||||
std::cout << "DatabaseUpdateService::stop, process done" << std::endl;
|
||||
}
|
||||
|
||||
@@ -34,11 +30,3 @@ DatabaseUpdateService::restart(void)
|
||||
start();
|
||||
}
|
||||
|
||||
bool
|
||||
DatabaseUpdateService::isScanning(void) const
|
||||
{
|
||||
// scanning is active only if a thread is running the updater
|
||||
return _thread.get_id() != boost::thread::id();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user