mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Add a method to see whether a WorkItem has executed yet.
This commit is contained in:
parent
5caf62b19f
commit
7b2cb8d04f
2 changed files with 12 additions and 1 deletions
|
|
@ -120,6 +120,7 @@ void ThreadPool::Context::updateAccumulatedPriorityBiases()
|
|||
void ThreadPool::WorkItem::process()
|
||||
{
|
||||
execute();
|
||||
mExecuted = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue