diff options
Diffstat (limited to 'config/src')
4 files changed, 13 insertions, 11 deletions
diff --git a/config/src/vespa/config/helper/configfetcher.cpp b/config/src/vespa/config/helper/configfetcher.cpp index ec4ea42d0bb..db0a64b248c 100644 --- a/config/src/vespa/config/helper/configfetcher.cpp +++ b/config/src/vespa/config/helper/configfetcher.cpp @@ -15,7 +15,7 @@ VESPA_THREAD_STACK_TAG(config_fetcher_thread); ConfigFetcher::ConfigFetcher(std::shared_ptr<IConfigContext> context) : _poller(std::make_unique<ConfigPoller>(std::move(context))), - _thread(std::make_unique<vespalib::Thread>()), + _thread(), _closed(false), _started(false) { @@ -36,7 +36,7 @@ ConfigFetcher::start() throw ConfigTimeoutException("ConfigFetcher::start timed out getting initial config"); } LOG(debug, "Starting fetcher thread..."); - *_thread = vespalib::Thread::start(*_poller, config_fetcher_thread); + _thread = vespalib::thread::start(*_poller, config_fetcher_thread); _started = true; LOG(debug, "Fetcher thread started"); } @@ -58,7 +58,8 @@ ConfigFetcher::close() if (!_closed) { _poller->close(); if (_started) - _thread->join(); + _thread.join(); + _closed = true; } } diff --git a/config/src/vespa/config/helper/configfetcher.h b/config/src/vespa/config/helper/configfetcher.h index 2ed236eda68..67e8f5d134f 100644 --- a/config/src/vespa/config/helper/configfetcher.h +++ b/config/src/vespa/config/helper/configfetcher.h @@ -5,8 +5,7 @@ #include <vespa/config/helper/ifetchercallback.h> #include <vespa/config/subscription/sourcespec.h> #include <atomic> - -namespace vespalib { class Thread; } +#include <thread> namespace config { @@ -31,7 +30,7 @@ public: int64_t getGeneration() const; private: std::unique_ptr<ConfigPoller> _poller; - std::unique_ptr<vespalib::Thread> _thread; + std::thread _thread; std::atomic<bool> _closed; std::atomic<bool> _started; }; diff --git a/config/src/vespa/config/retriever/simpleconfigurer.cpp b/config/src/vespa/config/retriever/simpleconfigurer.cpp index 1e89f51ec03..83e56737f8d 100644 --- a/config/src/vespa/config/retriever/simpleconfigurer.cpp +++ b/config/src/vespa/config/retriever/simpleconfigurer.cpp @@ -25,7 +25,7 @@ SimpleConfigurer::start() if (!_retriever->isClosed()) { LOG(debug, "Polling for config"); runConfigure(); - _thread = vespalib::Thread::start(*this, simple_configurer_thread); + _thread = vespalib::thread::start(*this, simple_configurer_thread); _started = true; } } @@ -38,9 +38,11 @@ SimpleConfigurer::~SimpleConfigurer() void SimpleConfigurer::close() { - _retriever->close(); - if (_started) - _thread.join(); + if (!_retriever->isClosed()) { + _retriever->close(); + if (_started) + _thread.join(); + } } void diff --git a/config/src/vespa/config/retriever/simpleconfigurer.h b/config/src/vespa/config/retriever/simpleconfigurer.h index aa6508c75a2..95fa12610cb 100644 --- a/config/src/vespa/config/retriever/simpleconfigurer.h +++ b/config/src/vespa/config/retriever/simpleconfigurer.h @@ -46,7 +46,7 @@ private: SimpleConfigRetriever::UP _retriever; SimpleConfigurable * const _configurable; - vespalib::Thread _thread; + std::thread _thread; std::atomic<bool> _started; }; |