diff options
author | David Robillard <d@drobilla.net> | 2012-11-22 06:16:10 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-11-22 06:16:10 +0000 |
commit | c4b51e0935f75d118164fab6bfcefc6ddf69867e (patch) | |
tree | f4f6bfc5e0a19561dd7860f82976dff3fdbb68a6 /raul/DoubleBuffer.hpp | |
parent | 5642368878114fd99cb6bf877258945a38c3c0b9 (diff) | |
download | raul-c4b51e0935f75d118164fab6bfcefc6ddf69867e.tar.gz raul-c4b51e0935f75d118164fab6bfcefc6ddf69867e.tar.bz2 raul-c4b51e0935f75d118164fab6bfcefc6ddf69867e.zip |
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4851 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/DoubleBuffer.hpp')
-rw-r--r-- | raul/DoubleBuffer.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/raul/DoubleBuffer.hpp b/raul/DoubleBuffer.hpp index 1c159e9..28080d6 100644 --- a/raul/DoubleBuffer.hpp +++ b/raul/DoubleBuffer.hpp @@ -35,7 +35,6 @@ namespace Raul { template<typename T> class DoubleBuffer { public: - inline DoubleBuffer(T val) : _state(RAUL_DB_READ_WRITE) { @@ -56,8 +55,8 @@ public: } inline bool set(T new_val) { - if (_state.compare_and_exchange(RAUL_DB_READ_WRITE, RAUL_DB_READ_LOCK)) { - + if (_state.compare_and_exchange(RAUL_DB_READ_WRITE, + RAUL_DB_READ_LOCK)) { // locked _vals[1] for write _vals[1] = new_val; _read_val = &_vals[1]; @@ -67,8 +66,8 @@ public: // concurrent calls here are fine. good, actually - caught // the WRITE_READ state immediately after it was set above - } else if (_state.compare_and_exchange(RAUL_DB_WRITE_READ, RAUL_DB_LOCK_READ)) { - + } else if (_state.compare_and_exchange(RAUL_DB_WRITE_READ, + RAUL_DB_LOCK_READ)) { // locked _vals[0] for write _vals[0] = new_val; _read_val = &_vals[0]; @@ -76,9 +75,7 @@ public: return true; } else { - return false; - } } |