Found one more usage of boost::recursive_mutex in PlaybackService. Removed

it.
This commit is contained in:
casey langen 2017-01-01 15:06:55 -08:00
parent c5d8a3c608
commit 0d8c86be4f
3 changed files with 13 additions and 15 deletions

View File

@ -46,8 +46,6 @@
#include <core/audio/ITransport.h> #include <core/audio/ITransport.h>
#include <boost/shared_ptr.hpp>
#include "ITopLevelLayout.h" #include "ITopLevelLayout.h"
namespace musik { namespace musik {

View File

@ -157,7 +157,7 @@ void PlaybackService::ResetRemotes() {
} }
void PlaybackService::PrepareNextTrack() { void PlaybackService::PrepareNextTrack() {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
if (this->Count() > 0) { if (this->Count() > 0) {
/* repeat track, just keep playing the same thing over and over */ /* repeat track, just keep playing the same thing over and over */
@ -194,7 +194,7 @@ void PlaybackService::SetRepeatMode(RepeatMode mode) {
} }
void PlaybackService::ToggleShuffle() { void PlaybackService::ToggleShuffle() {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
/* remember the ID of the playing track -- we're going to need to look /* remember the ID of the playing track -- we're going to need to look
it up after the shuffle */ it up after the shuffle */
@ -251,7 +251,7 @@ void PlaybackService::ProcessMessage(IMessage &message) {
TrackPtr track; TrackPtr track;
{ {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
track = this->playlist.Get(this->index); track = this->playlist.Get(this->index);
} }
@ -305,7 +305,7 @@ bool PlaybackService::Next() {
return false; return false;
} }
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
if (this->playlist.Count() > index + 1) { if (this->playlist.Count() > index + 1) {
this->Play(index + 1); this->Play(index + 1);
@ -342,12 +342,12 @@ bool PlaybackService::Previous() {
} }
bool PlaybackService::IsShuffled() { bool PlaybackService::IsShuffled() {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
return this->unshuffled.Count() > 0; return this->unshuffled.Count() > 0;
} }
size_t PlaybackService::Count() { size_t PlaybackService::Count() {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
return this->playlist.Count(); return this->playlist.Count();
} }
@ -378,7 +378,7 @@ void PlaybackService::Play(TrackList& tracks, size_t index) {
temp.CopyFrom(tracks); temp.CopyFrom(tracks);
{ {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
this->playlist.Swap(temp); this->playlist.Swap(temp);
this->unshuffled.Clear(); this->unshuffled.Clear();
} }
@ -389,7 +389,7 @@ void PlaybackService::Play(TrackList& tracks, size_t index) {
} }
void PlaybackService::CopyTo(TrackList& target) { void PlaybackService::CopyTo(TrackList& target) {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
target.CopyFrom(this->playlist); target.CopyFrom(this->playlist);
} }
@ -442,7 +442,7 @@ double PlaybackService::GetDuration() {
TrackPtr track; TrackPtr track;
{ {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
size_t index = this->index; size_t index = this->index;
if (index < this->playlist.Count()) { if (index < this->playlist.Count()) {
@ -459,7 +459,7 @@ double PlaybackService::GetDuration() {
} }
IRetainedTrack* PlaybackService::GetTrack(size_t index) { IRetainedTrack* PlaybackService::GetTrack(size_t index) {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
const size_t count = this->playlist.Count(); const size_t count = this->playlist.Count();
@ -471,7 +471,7 @@ IRetainedTrack* PlaybackService::GetTrack(size_t index) {
} }
TrackPtr PlaybackService::GetTrackAtIndex(size_t index) { TrackPtr PlaybackService::GetTrackAtIndex(size_t index) {
boost::recursive_mutex::scoped_lock lock(this->playlistMutex); std::unique_lock<std::recursive_mutex> lock(this->playlistMutex);
return this->playlist.Get(index); return this->playlist.Get(index);
} }

View File

@ -46,7 +46,7 @@
#include <core/support/Preferences.h> #include <core/support/Preferences.h>
#include <core/runtime/IMessageTarget.h> #include <core/runtime/IMessageTarget.h>
#include <boost/thread/recursive_mutex.hpp> #include <mutex>
namespace musik { namespace musik {
namespace box { namespace box {
@ -109,7 +109,7 @@ namespace musik {
TrackList playlist; TrackList playlist;
TrackList unshuffled; TrackList unshuffled;
boost::recursive_mutex playlistMutex; std::recursive_mutex playlistMutex;
std::vector<std::shared_ptr<musik::core::sdk::IPlaybackRemote > > remotes; std::vector<std::shared_ptr<musik::core::sdk::IPlaybackRemote > > remotes;
std::shared_ptr<musik::core::Preferences> prefs; std::shared_ptr<musik::core::Preferences> prefs;