zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit d191f7b77d2970773015956fd835ea55ee99e4e4
parent dcf37e7e2ff1a256398eb0f43d4a99fcae663c17
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sun,  8 Apr 2012 13:50:50 -0400

Removed unused atomic class

Diffstat:
Dsrc/Misc/Atomic.cpp | 70----------------------------------------------------------------------
Dsrc/Misc/Atomic.h | 45---------------------------------------------
2 files changed, 0 insertions(+), 115 deletions(-)

diff --git a/src/Misc/Atomic.cpp b/src/Misc/Atomic.cpp @@ -1,70 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Atomic.cpp - Simple Atomic operation wrapper - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -template<class T> -Atomic<T>::Atomic(const T &val) - :value(val) -{ - pthread_mutex_init(&mutex, NULL); -} - -template<class T> -Atomic<T>::~Atomic() -{ - pthread_mutex_destroy(&mutex); -} - -template<class T> -void Atomic<T>::operator=(const T &nval) -{ - pthread_mutex_lock(&mutex); - value = nval; - pthread_mutex_unlock(&mutex); -} - -template<class T> -T Atomic<T>::operator()() const -{ - T tmp; - pthread_mutex_lock(&mutex); - tmp = value; - pthread_mutex_unlock(&mutex); - return tmp; -} - -template<class T> -T Atomic<T>::operator++() -{ - T tmp; - pthread_mutex_lock(&mutex); - tmp = ++value; - pthread_mutex_unlock(&mutex); - return tmp; -} - -template<class T> -T Atomic<T>::operator--() { - T tmp; - pthread_mutex_lock(&mutex); - tmp = --value; - pthread_mutex_unlock(&mutex); - return tmp; -} diff --git a/src/Misc/Atomic.h b/src/Misc/Atomic.h @@ -1,45 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Atomic.h - Simple Atomic operation wrapper - Copyright (C) 2009-2009 Mark McCurry - Author: Mark McCurry - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef ATOM_H -#define ATOM_H - -#include <pthread.h> - -/**Very simple threaded value container*/ -template<class T> -class Atomic -{ - public: - /**Initializes Atom - * @param val the value of the atom*/ - Atomic(const T &val); - ~Atomic(); - - void operator=(const T &val); - T operator()() const; - T operator++(); - T operator--(); - private: - mutable pthread_mutex_t mutex; - T value; -}; -#include "Atomic.cpp" -#endif