[Bf-blender-cvs] [74d7e0e] depsgraph_refactor: Properly lock the priority queue mutex when scheduling operations.

Lukas Tönne noreply at git.blender.org
Sun May 25 11:18:26 CEST 2014


Commit: 74d7e0e4192b5ce1fe3fd7b2e00f387ae34172bb
Author: Lukas Tönne
Date:   Fri May 23 17:34:28 2014 +0200
https://developer.blender.org/rB74d7e0e4192b5ce1fe3fd7b2e00f387ae34172bb

Properly lock the priority queue mutex when scheduling operations.

===================================================================

M	source/blender/depsgraph/intern/depsgraph_eval.cpp

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cpp b/source/blender/depsgraph/intern/depsgraph_eval.cpp
index 23d9b26..60bd6fa 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cpp
@@ -208,6 +208,8 @@ static bool is_node_ready(OperationDepsNode *node)
 
 void Scheduler::schedule_graph(Depsgraph *graph, eEvaluationContextType context_type)
 {
+	BLI_mutex_lock(&queue_mutex);
+	
 	for (Depsgraph::OperationNodes::const_iterator it = graph->operations.begin(); it != graph->operations.end(); ++it) {
 		OperationDepsNode *node = *it;
 		
@@ -215,6 +217,8 @@ void Scheduler::schedule_graph(Depsgraph *graph, eEvaluationContextType context_
 			schedule_node(graph, context_type, node);
 		}
 	}
+	
+	BLI_mutex_unlock(&queue_mutex);
 }
 
 void Scheduler::schedule_node(Depsgraph *graph, eEvaluationContextType context_type, OperationDepsNode *node)
@@ -230,6 +234,9 @@ void Scheduler::schedule_node(Depsgraph *graph, eEvaluationContextType context_t
 void Scheduler::finish_node(Depsgraph *graph, eEvaluationContextType context_type, OperationDepsNode *node)
 {
 	bool notify = false;
+	
+	BLI_mutex_lock(&queue_mutex);
+	
 	for (OperationDepsNode::Relations::const_iterator it = node->outlinks.begin(); it != node->outlinks.end(); ++it) {
 		DepsRelation *rel = *it;
 		
@@ -240,6 +247,9 @@ void Scheduler::finish_node(Depsgraph *graph, eEvaluationContextType context_typ
 			notify = true;
 		}
 	}
+	
+	BLI_mutex_unlock(&queue_mutex);
+	
 	if (notify)
 		BLI_condition_notify_all(&queue_cond);
 }




More information about the Bf-blender-cvs mailing list