From c4b51e0935f75d118164fab6bfcefc6ddf69867e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 22 Nov 2012 06:16:10 +0000 Subject: Tidy. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4851 a436a847-0d15-0410-975c-d299462d15a1 --- raul/DoubleBuffer.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'raul/DoubleBuffer.hpp') 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 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; - } } -- cgit v1.2.1