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-20 13:33:46 +0100 |
commit | af378d0298352b8d84dfe8529edcbf1358c1e1eb (patch) | |
tree | 8873739fef7c08894e6e730d3c88c5262af9c29c | |
parent | 38ed7f339c2d29fa730d7129aa4e9b4fcfa32624 (diff) |
Check for lock in setChunkSize. Remove lock in clearEvents.
-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) { |