diff --git a/Engine/source/platform/threads/threadPool.cpp b/Engine/source/platform/threads/threadPool.cpp index 5b96b495b..15cfcd9e0 100644 --- a/Engine/source/platform/threads/threadPool.cpp +++ b/Engine/source/platform/threads/threadPool.cpp @@ -120,6 +120,7 @@ void ThreadPool::Context::updateAccumulatedPriorityBiases() void ThreadPool::WorkItem::process() { execute(); + mExecuted = true; } //-------------------------------------------------------------------------- diff --git a/Engine/source/platform/threads/threadPool.h b/Engine/source/platform/threads/threadPool.h index 2f18a5bee..b77244034 100644 --- a/Engine/source/platform/threads/threadPool.h +++ b/Engine/source/platform/threads/threadPool.h @@ -194,6 +194,9 @@ class ThreadPool /// This is the primary function to implement by subclasses. virtual void execute() = 0; + /// This flag is set after the execute() method has completed. + bool mExecuted; + public: /// Construct a new work item. @@ -201,7 +204,8 @@ class ThreadPool /// @param context The work context in which the item should be placed. /// If NULL, the root context will be used. WorkItem( Context* context = 0 ) - : mContext( context ? context : Context::ROOT_CONTEXT() ) + : mContext( context ? context : Context::ROOT_CONTEXT() ), + mExecuted( false ) { } @@ -229,6 +233,12 @@ class ThreadPool /// Return the item's base priority value. /// @return item priority; defaults to 1.0. virtual F32 getPriority(); + + /// Has this work item been executed already? + bool hasExecuted() const + { + return mExecuted; + } }; typedef ThreadSafeRef< WorkItem > WorkItemPtr;