diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-19 19:35:55 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-19 19:35:55 +0100 |
commit | 88260c1ae4c513dc21f3be3f7f0a805665d4e643 (patch) | |
tree | ec490d35f187f89bb4809e66d3d8528148858c6b /src | |
parent | 195deff846013de59a10fd23f7a43a3d521f9325 (diff) |
Check for lock in setChunkSize. Remove lock in clearEvents.
Diffstat (limited to 'src')
-rw-r--r-- | src/audiocacheeventhandler.cc | 7 |
1 files changed, 5 insertions, 2 deletions
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 <assert.h> + #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<std::mutex> l(mutex); - // Iterate all events ignoring load events and handling close events. for(auto& event : *eventqueue) { |