[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57944] branches/soc-2013-depsgraph_mt/ source/blender/blenkernel/intern/scene.c: Fix issue when the same task gets added twice to the queue

Sergey Sharybin sergey.vfx at gmail.com
Tue Jul 2 21:23:12 CEST 2013


Revision: 57944
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57944
Author:   nazgul
Date:     2013-07-02 19:23:12 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
Fix issue when the same task gets added twice to the queue

Issue was caused by worker threads updating nodes valency
at the same time while we're filling the queue with "root"
nodes (leaf nodes which don't depend on others).

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c	2013-07-02 19:23:09 UTC (rev 57943)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c	2013-07-02 19:23:12 UTC (rev 57944)
@@ -1296,8 +1296,15 @@
 
 	/* Put all nodes which are already ready for schedule to the task pool.
 	 * usually its just a Scene node.
+	 *
+	 * We do lock here so no tthreads will start updating nodes valency
+	 * while we're still fillign the queue in. Otherwise it's possible
+	 * to run into situations when the same task is adding twice to the
+	 * queue due to non-safe nature of function below.
 	 */
+	BLI_spin_lock(&state.lock);
 	DAG_threaded_update_foreach_ready_node(scene, scene_update_object_add_task, task_pool);
+	BLI_spin_unlock(&state.lock);
 
 	/* work and wait until tasks are done */
 	BLI_task_pool_work_and_wait(task_pool);




More information about the Bf-blender-cvs mailing list