[Bf-blender-cvs] [3ce30823ffa] master: Cycles: Add utility class to simplify scoped spin locks
Sergey Sharybin
noreply at git.blender.org
Wed Apr 5 14:59:12 CEST 2017
Commit: 3ce30823ffadcf208ecd353a8541f7f86d85d91e
Author: Sergey Sharybin
Date: Wed Apr 5 14:57:34 2017 +0200
Branches: master
https://developer.blender.org/rB3ce30823ffadcf208ecd353a8541f7f86d85d91e
Cycles: Add utility class to simplify scoped spin locks
===================================================================
M intern/cycles/util/util_thread.h
===================================================================
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index 1b4e87ebf03..1e91fb8a706 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -106,6 +106,23 @@ protected:
#endif
};
+class thread_scoped_spin_lock {
+public:
+ explicit thread_scoped_spin_lock(thread_spin_lock& lock)
+ : lock_(lock) {
+ lock_.lock();
+ }
+
+ ~thread_scoped_spin_lock() {
+ lock_.unlock();
+ }
+
+ /* TODO(sergey): Implement manual control over lock/unlock. */
+
+protected:
+ thread_spin_lock& lock_;
+};
+
CCL_NAMESPACE_END
#endif /* __UTIL_THREAD_H__ */
More information about the Bf-blender-cvs
mailing list