summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-01-29 17:28:32 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-01-29 17:28:32 +0100
commit9ebd9aa0c3429f896e6c41f279b570ba36aec674 (patch)
treea88d3c8d1d5cb962607b0430d3370075de55a709
parent0e550bc28852a42896a0cb3711f78d9f3e520b71 (diff)
Glocke suggestions
-rw-r--r--src/audiocache.cc2
-rw-r--r--src/audiocacheeventhandler.cc23
-rw-r--r--src/audiocacheeventhandler.h4
3 files changed, 12 insertions, 17 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index 7856f4a..86052c7 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -272,7 +272,7 @@ void AudioCache::setAsyncMode(bool async)
bool AudioCache::asyncMode() const
{
- return event_handler.getThreaded();
+ return event_handler.isThreaded();
}
size_t AudioCache::getNumberOfUnderruns() const
diff --git a/src/audiocacheeventhandler.cc b/src/audiocacheeventhandler.cc
index 7322785..6ec68b5 100644
--- a/src/audiocacheeventhandler.cc
+++ b/src/audiocacheeventhandler.cc
@@ -53,9 +53,7 @@ public:
};
AudioCacheEventHandler::AudioCacheEventHandler(AudioCacheIDManager& id_manager)
- // Hack to be able to forward declare CacheEvent:
- : eventqueue(new std::list<CacheEvent>())
- , id_manager(id_manager)
+ : id_manager(id_manager)
{
}
@@ -69,9 +67,6 @@ AudioCacheEventHandler::~AudioCacheEventHandler()
{
handleCloseCache(id);
}
-
- // Hack to be able to forward declare CacheEvent:
- delete eventqueue;
}
void AudioCacheEventHandler::start()
@@ -119,7 +114,7 @@ void AudioCacheEventHandler::setThreaded(bool threaded)
this->threaded = threaded;
}
-bool AudioCacheEventHandler::getThreaded() const
+bool AudioCacheEventHandler::isThreaded() const
{
return threaded;
}
@@ -206,7 +201,7 @@ AudioCacheFile& AudioCacheEventHandler::openFile(const std::string& filename)
void AudioCacheEventHandler::clearEvents()
{
// Iterate all events ignoring load events and handling close events.
- for(auto& event : *eventqueue)
+ for(auto& event : eventqueue)
{
if(event.eventType == EventType::Close)
{
@@ -214,7 +209,7 @@ void AudioCacheEventHandler::clearEvents()
}
}
- eventqueue->clear();
+ eventqueue.clear();
}
void AudioCacheEventHandler::handleLoadNextEvent(CacheEvent& cache_event)
@@ -263,14 +258,14 @@ void AudioCacheEventHandler::thread_main()
sem.wait();
mutex.lock();
- if(eventqueue->empty())
+ if(eventqueue.empty())
{
mutex.unlock();
continue;
}
- CacheEvent cache_event = eventqueue->front();
- eventqueue->pop_front();
+ CacheEvent cache_event = eventqueue.front();
+ eventqueue.pop_front();
mutex.unlock();
// TODO: Skip event if cache_event.pos < cache.pos
@@ -298,7 +293,7 @@ void AudioCacheEventHandler::pushEvent(CacheEvent& cache_event)
if(cache_event.eventType == EventType::LoadNext)
{
- for(auto& queued_event : *eventqueue)
+ for(auto& queued_event : eventqueue)
{
if((queued_event.eventType == EventType::LoadNext) &&
(cache_event.afile->getFilename() ==
@@ -318,7 +313,7 @@ void AudioCacheEventHandler::pushEvent(CacheEvent& cache_event)
if(!found)
{
// The event was not already on the list, create a new one.
- eventqueue->push_back(cache_event);
+ eventqueue.push_back(cache_event);
}
}
diff --git a/src/audiocacheeventhandler.h b/src/audiocacheeventhandler.h
index daf7bb9..473a010 100644
--- a/src/audiocacheeventhandler.h
+++ b/src/audiocacheeventhandler.h
@@ -59,7 +59,7 @@ public:
void setThreaded(bool threaded);
//! Get current threaded status.
- bool getThreaded() const;
+ bool isThreaded() const;
//! Lock thread mutex.
//! This methods are supplied to make this class lockable by std::lock_guard
@@ -101,7 +101,7 @@ protected:
std::mutex mutex;
- std::list<CacheEvent>* eventqueue;
+ std::list<CacheEvent> eventqueue;
bool threaded{false};
Semaphore sem;