From 88260c1ae4c513dc21f3be3f7f0a805665d4e643 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 19 Jan 2016 19:35:55 +0100 Subject: Check for lock in setChunkSize. Remove lock in clearEvents. --- src/audiocacheeventhandler.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/audiocacheeventhandler.cc b/src/audiocacheeventhandler.cc index 598cc15..897f2fb 100644 --- a/src/audiocacheeventhandler.cc +++ b/src/audiocacheeventhandler.cc @@ -26,6 +26,8 @@ */ #include "audiocacheeventhandler.h" +#include + #include "audiocachefile.h" #include "audiocache.h" #include "audiocacheidmanager.h" @@ -165,6 +167,9 @@ void AudioCacheEventHandler::pushCloseEvent(cacheid_t id) void AudioCacheEventHandler::setChunkSize(size_t chunksize) { + // We should already locked when this method is called. + assert(!mutex.try_lock()); + if(this->chunksize == chunksize) { return; @@ -192,8 +197,6 @@ AudioCacheFile& AudioCacheEventHandler::openFile(const std::string& filename) void AudioCacheEventHandler::clearEvents() { - std::lock_guard l(mutex); - // Iterate all events ignoring load events and handling close events. for(auto& event : *eventqueue) { -- cgit v1.2.3