summaryrefslogtreecommitdiff
path: root/src/audiocachefile.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-01-21 11:20:32 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-01-21 11:20:32 +0100
commitdb62f48f18a61818f88051f8358976ba2ed430f4 (patch)
tree794c4b553411ada20a454be15b29eb27ceb7fb24 /src/audiocachefile.cc
parente92be2c5fb50736b0b4cd4729fea31f6289c15ed (diff)
Add missing mutex lock guards to AudioCacheFiles get and release methods.
Diffstat (limited to 'src/audiocachefile.cc')
-rw-r--r--src/audiocachefile.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/audiocachefile.cc b/src/audiocachefile.cc
index c1fdd7b..0a81ca4 100644
--- a/src/audiocachefile.cc
+++ b/src/audiocachefile.cc
@@ -123,6 +123,8 @@ void AudioCacheFile::readChunk(const CacheChannels& channels,
AudioCacheFile& AudioCacheFiles::getFile(const std::string& filename)
{
+ std::lock_guard<std::mutex> lock(mutex);
+
AudioCacheFile* cacheAudioFile = nullptr;
auto it = audiofiles.find(filename);
@@ -146,6 +148,8 @@ AudioCacheFile& AudioCacheFiles::getFile(const std::string& filename)
void AudioCacheFiles::releaseFile(const std::string& filename)
{
+ std::lock_guard<std::mutex> lock(mutex);
+
auto it = audiofiles.find(filename);
if(it == audiofiles.end())
{