diff --git a/Parallel/Core/vtkThreadedCallbackQueue.h b/Parallel/Core/vtkThreadedCallbackQueue.h index 25c0b47b97f827b610920f0cac9cac80fd1c361b..34a6dadd8cecd3af2f7442ac803db8f3a45c741f 100644 --- a/Parallel/Core/vtkThreadedCallbackQueue.h +++ b/Parallel/Core/vtkThreadedCallbackQueue.h @@ -113,12 +113,27 @@ public: public: vtkBaseTypeMacro(vtkSharedFutureBase, vtkObjectBase); - vtkSharedFutureBase(); + vtkSharedFutureBase() + : NumberOfPriorSharedFuturesRemaining(0) + , Status(CONSTRUCTING) + { + } /** * Blocks current thread until the task associated with this future has terminated. */ - virtual void Wait() const; + virtual void Wait() const + { + if (this->Status == READY) + { + return; + } + std::unique_lock<std::mutex> lock(this->Mutex); + if (this->Status != READY) + { + this->ConditionVariable.wait(lock, [this] { return this->Status == READY; }); + } + } friend class vtkThreadedCallbackQueue; diff --git a/Parallel/Core/vtkThreadedCallbackQueue.txx b/Parallel/Core/vtkThreadedCallbackQueue.txx index e0fd70a620515abadb4cb18bd847bc68b0d0445c..ca2927c07761f510ece9739c44fc3fa55aabd2ed 100644 --- a/Parallel/Core/vtkThreadedCallbackQueue.txx +++ b/Parallel/Core/vtkThreadedCallbackQueue.txx @@ -24,27 +24,6 @@ VTK_ABI_NAMESPACE_BEGIN -//----------------------------------------------------------------------------- -vtkThreadedCallbackQueue::vtkSharedFutureBase::vtkSharedFutureBase() - : NumberOfPriorSharedFuturesRemaining(0) - , Status(CONSTRUCTING) -{ -} - -//----------------------------------------------------------------------------- -void vtkThreadedCallbackQueue::vtkSharedFutureBase::Wait() const -{ - if (this->Status == READY) - { - return; - } - std::unique_lock<std::mutex> lock(this->Mutex); - if (this->Status != READY) - { - this->ConditionVariable.wait(lock, [this] { return this->Status == READY; }); - } -} - //----------------------------------------------------------------------------- template <> struct vtkThreadedCallbackQueue::ReturnValueWrapper<void, false>