player/Control: add LockGetSyncInfo()

This commit is contained in:
Max Kellermann
2018-09-23 17:15:08 +02:00
parent 8c638c50a3
commit 0e0bc7976f
2 changed files with 16 additions and 16 deletions

View File

@@ -434,6 +434,17 @@ public:
return state;
}
struct SyncInfo {
PlayerState state;
bool has_next_song;
};
gcc_pure
SyncInfo LockGetSyncInfo() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return {state, next_song != nullptr};
}
private:
/**
* Set the error. Discards any previous error condition.
@@ -527,10 +538,6 @@ public:
*/
void LockEnqueueSong(std::unique_ptr<DetachedSong> song) noexcept;
bool HasNextSong() const noexcept {
return next_song != nullptr;
}
/**
* Makes the player thread seek the specified song to a position.
*