summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/atomic.h20
-rw-r--r--src/audiocacheeventhandler.cc6
-rw-r--r--src/audiocacheidmanager.cc10
-rw-r--r--src/audiofile.cc4
-rw-r--r--src/drumgizmo.cc2
-rw-r--r--src/drumkitloader.cc10
-rw-r--r--src/midimapper.cc4
-rw-r--r--src/syncedsettings.h16
-rw-r--r--src/translation.cc8
9 files changed, 40 insertions, 40 deletions
diff --git a/src/atomic.h b/src/atomic.h
index 7ca5d1e..a29eeee 100644
--- a/src/atomic.h
+++ b/src/atomic.h
@@ -69,7 +69,7 @@ public:
: data{}
, mutex{}
{
- std::lock_guard<std::mutex> lock{other.mutex};
+ const std::lock_guard<std::mutex> lock{other.mutex};
data = other.data;
}
@@ -77,13 +77,13 @@ public:
: data{}
, mutex{}
{
- std::lock_guard<std::mutex> lock{other.mutex};
+ const std::lock_guard<std::mutex> lock{other.mutex};
std::swap(data, other.data);
}
T operator=(T data)
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
this->data = std::move(data);
return this->data;
}
@@ -100,42 +100,42 @@ public:
void store(T data)
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
this->data = std::move(data);
}
T load() const {
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return data;
}
T exchange(T data){
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
std::swap(data, this->data);
return data;
}
bool operator==(const T& other) const
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return other == data;
}
bool operator!=(const T& other) const
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return !(other == data);
}
bool operator==(const Atomic<T>& other) const
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return other.load() == data;
}
bool operator!=(const Atomic<T>& other) const
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return !(other.load() == data);
}
diff --git a/src/audiocacheeventhandler.cc b/src/audiocacheeventhandler.cc
index e1b9868..06bbf6e 100644
--- a/src/audiocacheeventhandler.cc
+++ b/src/audiocacheeventhandler.cc
@@ -179,7 +179,7 @@ size_t AudioCacheEventHandler::getChunkSize() const
AudioCacheFile& AudioCacheEventHandler::openFile(const std::string& filename)
{
- std::lock_guard<std::mutex> lock(mutex);
+ const std::lock_guard<std::mutex> lock(mutex);
return files.getFile(filename);
}
@@ -207,7 +207,7 @@ void AudioCacheEventHandler::handleLoadNextEvent(CacheEvent& cache_event)
void AudioCacheEventHandler::handleCloseEvent(CacheEvent& cache_event)
{
- std::lock_guard<std::mutex> lock(mutex);
+ const std::lock_guard<std::mutex> lock(mutex);
handleCloseCache(cache_event.id);
}
@@ -272,7 +272,7 @@ void AudioCacheEventHandler::pushEvent(CacheEvent& cache_event)
}
{
- std::lock_guard<std::mutex> lock(mutex);
+ const std::lock_guard<std::mutex> lock(mutex);
bool found = false;
diff --git a/src/audiocacheidmanager.cc b/src/audiocacheidmanager.cc
index 91a1457..693ed3c 100644
--- a/src/audiocacheidmanager.cc
+++ b/src/audiocacheidmanager.cc
@@ -37,7 +37,7 @@ AudioCacheIDManager::~AudioCacheIDManager()
void AudioCacheIDManager::init(unsigned int capacity)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
id2cache.resize(capacity);
available_ids.resize(capacity);
@@ -49,7 +49,7 @@ void AudioCacheIDManager::init(unsigned int capacity)
cache_t& AudioCacheIDManager::getCache(cacheid_t id)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
assert(id != CACHE_NOID);
assert(id != CACHE_DUMMYID);
@@ -62,7 +62,7 @@ cache_t& AudioCacheIDManager::getCache(cacheid_t id)
cacheid_t AudioCacheIDManager::registerID(const cache_t& cache)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
cacheid_t id = CACHE_NOID;
@@ -86,7 +86,7 @@ cacheid_t AudioCacheIDManager::registerID(const cache_t& cache)
void AudioCacheIDManager::releaseID(cacheid_t id)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
assert(id2cache[id].id != CACHE_NOID); // Test if it wasn't already released.
@@ -97,7 +97,7 @@ void AudioCacheIDManager::releaseID(cacheid_t id)
void AudioCacheIDManager::disableActive()
{
- // Run through all active cache_ts and disable them.
+ // Run through all active CacheBuffers and disable them.
for(auto& cache : id2cache)
{
if(cache.id != CACHE_NOID)
diff --git a/src/audiofile.cc b/src/audiofile.cc
index 2d61eb5..3f59fcf 100644
--- a/src/audiofile.cc
+++ b/src/audiofile.cc
@@ -61,7 +61,7 @@ bool AudioFile::isValid() const
void AudioFile::unload()
{
// Make sure we don't unload the object while loading it...
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
is_loaded = false;
@@ -76,7 +76,7 @@ void AudioFile::unload()
void AudioFile::load(LogFunction logger, std::size_t sample_limit)
{
// Make sure we don't unload the object while loading it...
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
if(this->data) // already loaded
{
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index bd729ab..85624ca 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -391,7 +391,7 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t* s, size_t sz)
{
// TODO: We should make all audiofiles reference counted and get rid of this lock.
- std::lock_guard<std::mutex> guard(af.mutex);
+ const std::lock_guard<std::mutex> guard(af.mutex);
renderSampleEvent(sample_event, pos, s, sz);
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 9167201..d73efff 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -93,7 +93,7 @@ void DrumKitLoader::deinit()
framesize_semaphore.post();
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
load_queue.clear();
}
@@ -301,13 +301,13 @@ void DrumKitLoader::loadKitAudio(const DrumKit& kit)
void DrumKitLoader::skip()
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
load_queue.clear();
}
void DrumKitLoader::setFrameSize(std::size_t framesize)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
this->framesize = framesize;
framesize_semaphore.post(); // Signal that the framesize has been set.
}
@@ -324,7 +324,7 @@ void DrumKitLoader::thread_main()
{
std::size_t size;
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
size = load_queue.size();
}
@@ -367,7 +367,7 @@ void DrumKitLoader::thread_main()
std::string filename;
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
if(load_queue.size() == 0)
{
diff --git a/src/midimapper.cc b/src/midimapper.cc
index b9316c5..345ce2f 100644
--- a/src/midimapper.cc
+++ b/src/midimapper.cc
@@ -30,7 +30,7 @@ std::vector<int> MidiMapper::lookup(int note_id)
{
std::vector<int> instruments;
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
for(const auto& map_entry : midimap)
{
@@ -49,7 +49,7 @@ std::vector<int> MidiMapper::lookup(int note_id)
void MidiMapper::swap(instrmap_t& instrmap, midimap_t& midimap)
{
- std::lock_guard<std::mutex> guard(mutex);
+ const std::lock_guard<std::mutex> guard(mutex);
std::swap(this->instrmap, instrmap);
std::swap(this->midimap, midimap);
diff --git a/src/syncedsettings.h b/src/syncedsettings.h
index 0fe5efd..d12277a 100644
--- a/src/syncedsettings.h
+++ b/src/syncedsettings.h
@@ -64,7 +64,7 @@ public:
: mutex{}
, data{}
{
- std::lock_guard<std::mutex> lock{other.mutex};
+ const std::lock_guard<std::mutex> lock{other.mutex};
data = other.data;
}
@@ -72,7 +72,7 @@ public:
: mutex{}
, data{}
{
- std::lock_guard<std::mutex> lock{other.mutex};
+ const std::lock_guard<std::mutex> lock{other.mutex};
std::swap(data, other.data);
}
@@ -80,19 +80,19 @@ public:
{
if (*this != &other)
{
- std::lock_guard<std::mutex> lock{mutex};
- std::lock_guard<std::mutex> lock2{other.mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock2{other.mutex};
data = other.data;
}
return *this;
}
-
+
Group<T>& operator=(Group<T>&& other)
{
if (*this != &other)
{
- std::lock_guard<std::mutex> lock{mutex};
- std::lock_guard<std::mutex> lock2{other.mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock2{other.mutex};
std::swap(data, other.data);
}
return *this;
@@ -100,7 +100,7 @@ public:
operator T() const
{
- std::lock_guard<std::mutex> lock{mutex};
+ const std::lock_guard<std::mutex> lock{mutex};
return data;
}
};
diff --git a/src/translation.cc b/src/translation.cc
index 18763e4..c71f6c0 100644
--- a/src/translation.cc
+++ b/src/translation.cc
@@ -62,13 +62,13 @@ bool comparator(const Text& a, const Text& b)
Translation::Translation()
{
- std::lock_guard<std::mutex>(singleton.mutex);
+ const std::lock_guard<std::mutex> lock(singleton.mutex);
++singleton.refcnt;
}
Translation::~Translation()
{
- std::lock_guard<std::mutex>(singleton.mutex);
+ const std::lock_guard<std::mutex> lock(singleton.mutex);
--singleton.refcnt;
@@ -219,7 +219,7 @@ bool Translation::load(const char* catalog, std::size_t size)
std::sort(texts.begin(), texts.end(), comparator);
{
- std::lock_guard<std::mutex>(singleton.mutex);
+ const std::lock_guard<std::mutex> lock(singleton.mutex);
std::swap(singleton.texts, texts);
}
@@ -228,7 +228,7 @@ bool Translation::load(const char* catalog, std::size_t size)
const char* Translation::gettext(std::uint64_t msgid, const char* original)
{
- std::lock_guard<std::mutex>(singleton.mutex);
+ const std::lock_guard<std::mutex> lock(singleton.mutex);
if(singleton.refcnt == 0)
{
return original;