diff options
-rw-r--r-- | intern/cycles/util/util_thread.h | 17 |
1 files changed, 17 insertions, 0 deletions
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__ */ |