[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52031] trunk/blender/intern/cycles/util: Cycles: no need in spin lock in memory statistics

Sergey Sharybin sergey.vfx at gmail.com
Fri Nov 9 09:47:09 CET 2012


Revision: 52031
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52031
Author:   nazgul
Date:     2012-11-09 08:47:08 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
Cycles: no need in spin lock in memory statistics

This functions are called from device code which is guaranteed
not to be called simultaneously from different threads.

Modified Paths:
--------------
    trunk/blender/intern/cycles/util/util_stats.h
    trunk/blender/intern/cycles/util/util_thread.h

Modified: trunk/blender/intern/cycles/util/util_stats.h
===================================================================
--- trunk/blender/intern/cycles/util/util_stats.h	2012-11-09 08:46:53 UTC (rev 52030)
+++ trunk/blender/intern/cycles/util/util_stats.h	2012-11-09 08:47:08 UTC (rev 52031)
@@ -19,31 +19,22 @@
 #ifndef __UTIL_STATS_H__
 #define __UTIL_STATS_H__
 
-#include "util_thread.h"
-
 CCL_NAMESPACE_BEGIN
 
 class Stats {
 public:
-	Stats() : lock(), mem_used(0), mem_peak(0) {}
+	Stats() : mem_used(0), mem_peak(0) {}
 
 	void mem_alloc(size_t size) {
-		lock.lock();
-
 		mem_used += size;
 		if(mem_used > mem_peak)
 			mem_peak = mem_used;
-
-		lock.unlock();
 	}
 
 	void mem_free(size_t size) {
-		lock.lock();
 		mem_used -= size;
-		lock.unlock();
 	}
 
-	spin_lock lock;
 	size_t mem_used;
 	size_t mem_peak;
 };

Modified: trunk/blender/intern/cycles/util/util_thread.h
===================================================================
--- trunk/blender/intern/cycles/util/util_thread.h	2012-11-09 08:46:53 UTC (rev 52030)
+++ trunk/blender/intern/cycles/util/util_thread.h	2012-11-09 08:47:08 UTC (rev 52031)
@@ -33,9 +33,6 @@
 typedef boost::mutex::scoped_lock thread_scoped_lock;
 typedef boost::condition_variable thread_condition_variable;
 
-/* use boost for spinlocks as well */
-typedef boost::detail::spinlock spin_lock;
-
 /* own pthread based implementation, to avoid boost version conflicts with
  * dynamically loaded blender plugins */
 




More information about the Bf-blender-cvs mailing list