From ffbf0a1b12ae840f5fd5a21b3663743ee9beb26c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 9 Nov 2012 08:47:08 +0000 Subject: [PATCH] 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. --- intern/cycles/util/util_stats.h | 11 +---------- intern/cycles/util/util_thread.h | 3 --- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/intern/cycles/util/util_stats.h b/intern/cycles/util/util_stats.h index 405c81a1e1f..27638015f40 100644 --- a/intern/cycles/util/util_stats.h +++ b/intern/cycles/util/util_stats.h @@ -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; }; diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index 6d1bd0023a7..843764ca9d6 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -33,9 +33,6 @@ typedef boost::mutex thread_mutex; 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 */