hold worker busy state in renderbackend rather than in renderworker
Workers run in different threads and the backends can poll whether the worker is currently busy or not. However the previous iteration has the worker (and an atomic int) provide the busy state which could easily desync with the main thread (since all workers run in different threads). By holding the busy states in the main thread, the main thread will always be able to poll the busy state accurately.
This commit is contained in:
@@ -6,16 +6,10 @@
|
||||
|
||||
RenderWorker::RenderWorker(QObject *parent) :
|
||||
QObject(parent),
|
||||
working_(0),
|
||||
started_(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool RenderWorker::IsAvailable()
|
||||
{
|
||||
return !working_;
|
||||
}
|
||||
|
||||
bool RenderWorker::Init()
|
||||
{
|
||||
if (started_) {
|
||||
@@ -51,9 +45,6 @@ NodeValueTable RenderWorker::RenderAsSibling(NodeDependency dep)
|
||||
|
||||
//qDebug() << "Processing" << node->id();
|
||||
|
||||
// Set working state
|
||||
working_++;
|
||||
|
||||
// Firstly we check if this node is a "Block", if it is that means it's part of a linked list of mutually exclusive
|
||||
// nodes based on time and we might need to locate which Block to attach to
|
||||
if (node->IsTrack()) {
|
||||
@@ -65,9 +56,6 @@ NodeValueTable RenderWorker::RenderAsSibling(NodeDependency dep)
|
||||
|
||||
// We're done!
|
||||
|
||||
// End this working state
|
||||
working_--;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user