diff --git a/Concurrency/AsyncTaskQueue.cpp b/Concurrency/AsyncTaskQueue.cpp index d4f2f84a5..798683c39 100644 --- a/Concurrency/AsyncTaskQueue.cpp +++ b/Concurrency/AsyncTaskQueue.cpp @@ -103,3 +103,8 @@ void DeferringAsyncTaskQueue::perform() { } }); } + +void DeferringAsyncTaskQueue::flush() { + perform(); + AsyncTaskQueue::flush(); +} diff --git a/Concurrency/AsyncTaskQueue.hpp b/Concurrency/AsyncTaskQueue.hpp index 7e48a404e..da5d052c8 100644 --- a/Concurrency/AsyncTaskQueue.hpp +++ b/Concurrency/AsyncTaskQueue.hpp @@ -87,6 +87,11 @@ class DeferringAsyncTaskQueue: public AsyncTaskQueue { */ void perform(); + /*! + Blocks the caller until all previously-enqueud functions have completed. + */ + void flush(); + private: // TODO: this is a shared_ptr because of the issues capturing moveables in C++11; // switch to a unique_ptr if/when adapting to C++14