diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-19 14:12:29 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-19 14:12:29 +0000 |
commit | 83b647759ae313057b7fcff3a5823b212e0a9a69 (patch) | |
tree | f635b3878d73fe24570fb23f5a2325eb8dbd0956 /filedistribution | |
parent | 255cf0089aa663da16125ad9b37df93650ea200c (diff) |
Delay starting of eventloop thread until Component object is properly constructed.
Diffstat (limited to 'filedistribution')
-rw-r--r-- | filedistribution/src/apps/filedistributor/filedistributor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/filedistribution/src/apps/filedistributor/filedistributor.cpp b/filedistribution/src/apps/filedistributor/filedistributor.cpp index ae44165057f..02ac28e9a1b 100644 --- a/filedistribution/src/apps/filedistributor/filedistributor.cpp +++ b/filedistribution/src/apps/filedistributor/filedistributor.cpp @@ -57,7 +57,7 @@ class FileDistributor : public config::IFetcherCallback<ZookeepersConfig>, const std::shared_ptr<StateServerImpl> _stateServer; private: - std::thread _downloaderEventLoopThread; + std::unique_ptr<std::thread> _downloaderEventLoopThread; config::ConfigFetcher _configFetcher; template <class T> @@ -86,10 +86,10 @@ class FileDistributor : public config::IFetcherCallback<ZookeepersConfig>, _manager(track(new FileDownloaderManager(_downloader, _model))), _rpcHandler(track(new FileDistributorRPC(rpcConfig.connectionspec, _manager))), _stateServer(track(new StateServerImpl(fileDistributorConfig.stateport))), - _downloaderEventLoopThread([downloader=_downloader] () { downloader->runEventLoop(); }), + _downloaderEventLoopThread(), _configFetcher(configUri.getContext()) - { + _downloaderEventLoopThread = std::make_unique<std::thread>([downloader=_downloader] () { downloader->runEventLoop(); }); _manager->start(); _rpcHandler->start(); @@ -110,7 +110,7 @@ class FileDistributor : public config::IFetcherCallback<ZookeepersConfig>, _zk->disableRetries(); _downloader->close(); - _downloaderEventLoopThread.join(); + _downloaderEventLoopThread->join(); } }; |