From 93679f8d48ea5606fde97884eef81d962232be79 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 2 Jun 2022 12:50:45 -0400 Subject: [PATCH] Reduce potential surprise in DeferringAsyncTaskQueue::flush. --- Concurrency/AsyncTaskQueue.cpp | 5 +++++ Concurrency/AsyncTaskQueue.hpp | 5 +++++ 2 files changed, 10 insertions(+) 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