diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-09-21 20:29:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-21 20:29:48 +0200 |
commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/common/synchronized_wrapper.h | |
parent | README: Specify master branch for Travis CI badge (diff) | |
parent | Fix Travis clang-format check (diff) | |
download | yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.bz2 yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.lz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.zst yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip |
Diffstat (limited to 'src/common/synchronized_wrapper.h')
-rw-r--r-- | src/common/synchronized_wrapper.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h index 07105a198..04b4f2e51 100644 --- a/src/common/synchronized_wrapper.h +++ b/src/common/synchronized_wrapper.h @@ -12,15 +12,14 @@ namespace Common { /** * Wraps an object, only allowing access to it via a locking reference wrapper. Good to ensure no * one forgets to lock a mutex before acessing an object. To access the wrapped object construct a - * SyncronizedRef on this wrapper. Inspired by Rust's Mutex type (http://doc.rust-lang.org/std/sync/struct.Mutex.html). + * SyncronizedRef on this wrapper. Inspired by Rust's Mutex type + * (http://doc.rust-lang.org/std/sync/struct.Mutex.html). */ template <typename T> class SynchronizedWrapper { public: template <typename... Args> - SynchronizedWrapper(Args&&... args) : - data(std::forward<Args>(args)...) { - } + SynchronizedWrapper(Args&&... args) : data(std::forward<Args>(args)...) {} private: template <typename U> @@ -58,11 +57,19 @@ public: return *this; } - T& operator*() { return wrapper->data; } - const T& operator*() const { return wrapper->data; } + T& operator*() { + return wrapper->data; + } + const T& operator*() const { + return wrapper->data; + } - T* operator->() { return &wrapper->data; } - const T* operator->() const { return &wrapper->data; } + T* operator->() { + return &wrapper->data; + } + const T* operator->() const { + return &wrapper->data; + } private: SynchronizedWrapper<T>* wrapper; |