[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57943] branches/soc-2013-depsgraph_mt/ source/blender/blenlib/intern/task.c: Added missing mutex lock around do_exit assignment in task scheduler

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


Revision: 57943
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57943
Author:   nazgul
Date:     2013-07-02 19:23:09 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
Added missing mutex lock around do_exit assignment in task scheduler

Without this lock it's possible that thread_wait_pop will stuck
at the point where it await for new task in the queue but in
fact exit was requested already.

This ended up in deadlock in some circumstances. Really random
because it totally depends on timings.

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/task.c

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/task.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/task.c	2013-07-02 19:23:06 UTC (rev 57942)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/task.c	2013-07-02 19:23:09 UTC (rev 57943)
@@ -186,8 +186,10 @@
 	Task *task;
 
 	/* stop all waiting threads */
+	BLI_mutex_lock(&scheduler->queue_mutex);
 	scheduler->do_exit = true;
 	BLI_condition_notify_all(&scheduler->queue_cond);
+	BLI_mutex_unlock(&scheduler->queue_mutex);
 
 	/* delete threads */
 	if(scheduler->threads) {




More information about the Bf-blender-cvs mailing list