player/Control: add "occupied" flag to skip REFRESH

Reduces main thread contention.  Avoids blocking the main thread in
"status" commands.
This commit is contained in:
Max Kellermann
2017-12-20 20:27:19 +01:00
parent 994c9a01e3
commit a431274b32
3 changed files with 30 additions and 1 deletions

View File

@@ -367,6 +367,8 @@ Player::StartDecoder(MusicPipe &_pipe) noexcept
void
Player::StopDecoder() noexcept
{
const PlayerControl::ScopeOccupied occupied(pc);
dc.Stop();
if (dc.pipe != nullptr) {
@@ -624,6 +626,8 @@ Player::SeekDecoder() noexcept
}
try {
const PlayerControl::ScopeOccupied occupied(pc);
dc.Seek(where + start_time);
} catch (...) {
/* decoder failure */