aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zencore/include/zencore/workthreadpool.h1
-rw-r--r--zencore/workthreadpool.cpp9
2 files changed, 10 insertions, 0 deletions
diff --git a/zencore/include/zencore/workthreadpool.h b/zencore/include/zencore/workthreadpool.h
index 0ddc65298..85054fca7 100644
--- a/zencore/include/zencore/workthreadpool.h
+++ b/zencore/include/zencore/workthreadpool.h
@@ -36,6 +36,7 @@ public:
void ScheduleWork(Ref<IWork> Work);
void ScheduleWork(std::function<void()>&& Work);
+ void Flush();
[[nodiscard]] size_t PendingWork() const;
private:
diff --git a/zencore/workthreadpool.cpp b/zencore/workthreadpool.cpp
index 4291d1581..a6c6bc0f7 100644
--- a/zencore/workthreadpool.cpp
+++ b/zencore/workthreadpool.cpp
@@ -55,6 +55,15 @@ WorkerThreadPool::PendingWork() const
}
void
+WorkerThreadPool::Flush()
+{
+ while (m_WorkQueue.Size() > 0)
+ {
+ Sleep(1);
+ }
+}
+
+void
WorkerThreadPool::WorkerThreadFunction()
{
do