From 2247c698d8f7dc5725f4d491e798c5147273ca1e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 14 Jul 2016 18:51:08 +0200 Subject: Move free-wheel control into the main run method. --- src/audiocacheeventhandler.cc | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/audiocacheeventhandler.cc') diff --git a/src/audiocacheeventhandler.cc b/src/audiocacheeventhandler.cc index a0261a5..a0327b5 100644 --- a/src/audiocacheeventhandler.cc +++ b/src/audiocacheeventhandler.cc @@ -96,26 +96,12 @@ void AudioCacheEventHandler::stop() void AudioCacheEventHandler::setThreaded(bool threaded) { - if(this->threaded == threaded) - { - return; - } - - if(threaded && !running) - { - start(); - } - else if(!threaded && running) - { - stop(); - } - - this->threaded = threaded; + this->threaded.store(threaded); } bool AudioCacheEventHandler::isThreaded() const { - return threaded; + return threaded.load(); } void AudioCacheEventHandler::lock() @@ -279,7 +265,7 @@ void AudioCacheEventHandler::thread_main() void AudioCacheEventHandler::pushEvent(CacheEvent& cache_event) { - if(!threaded) + if(!threaded.load()) { handleEvent(cache_event); return; -- cgit v1.2.3