From a6e9143baf48bdc093788545636570808f9c103c Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 2 Oct 2015 14:49:33 +0200 Subject: 6.5 --- zen/thread.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'zen/thread.h') diff --git a/zen/thread.h b/zen/thread.h index 15ebb3c3..d74eaa5b 100644 --- a/zen/thread.h +++ b/zen/thread.h @@ -73,8 +73,8 @@ public: private: class AsyncResult; - std::shared_ptr result; - size_t jobsTotal; + std::shared_ptr asyncResult; + size_t jobsTotal_; }; @@ -178,27 +178,27 @@ private: template inline -GetFirstResult::GetFirstResult() : result(std::make_shared()), jobsTotal(0) {} +GetFirstResult::GetFirstResult() : asyncResult(std::make_shared()), jobsTotal_(0) {} template template inline void GetFirstResult::addJob(Fun f) //f must return a std::unique_ptr containing a value on success { - auto result2 = result; //capture member variable, not "this"! - boost::thread t([result2, f] { result2->reportFinished(f()); }); - ++jobsTotal; + auto asyncResult2 = asyncResult; //capture member variable, not "this"! + boost::thread t([asyncResult2, f] { asyncResult2->reportFinished(f()); }); + ++jobsTotal_; t.detach(); //we have to be explicit since C++11: [thread.thread.destr] ~thread() calls std::terminate() if joinable()!!! } template template inline -bool GetFirstResult::timedWait(const Duration& duration) const { return result->waitForResult(jobsTotal, duration); } +bool GetFirstResult::timedWait(const Duration& duration) const { return asyncResult->waitForResult(jobsTotal_, duration); } template inline -std::unique_ptr GetFirstResult::get() const { return result->getResult(jobsTotal); } +std::unique_ptr GetFirstResult::get() const { return asyncResult->getResult(jobsTotal_); } } #endif //BOOST_THREAD_WRAP_H_78963234 -- cgit