summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-20 12:01:34 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-20 12:01:34 +0100
commita638a231d1cf8d04840b62354911520dab6fb6b3 (patch)
tree0a69b46481f8d1c098fc45431c9f24b5e232414f /src/lib
parent2c0d0c5230addee44dc2cebd08d4f832550a3d6c (diff)
Allow nested butler suspensions.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/butler.cc9
-rw-r--r--src/lib/butler.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index 3a75e67d7..07cb7b22b 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -54,7 +54,7 @@ Butler::Butler (shared_ptr<Player> player, shared_ptr<Log> log, AudioMapping aud
, _log (log)
, _prepare_work (new boost::asio::io_service::work (_prepare_service))
, _pending_seek_accurate (false)
- , _suspended (false)
+ , _suspended (0)
, _finished (false)
, _died (false)
, _stop_thread (false)
@@ -315,9 +315,9 @@ Butler::player_change (ChangeType type, bool frequent)
boost::mutex::scoped_lock lm (_mutex);
if (type == CHANGE_TYPE_PENDING) {
- _suspended = true;
+ ++_suspended;
} else if (type == CHANGE_TYPE_DONE) {
-
+ --_suspended;
if (_died || _pending_seek_position || frequent) {
return;
}
@@ -334,8 +334,9 @@ Butler::player_change (ChangeType type, bool frequent)
}
seek_unlocked (seek_to, true);
- _suspended = false;
_awaiting = seek_to;
+ } else if (type == CHANGE_TYPE_CANCELLED) {
+ --_suspended;
}
}
diff --git a/src/lib/butler.h b/src/lib/butler.h
index 513176821..b10c93e79 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -83,7 +83,7 @@ private:
boost::condition _arrived;
boost::optional<DCPTime> _pending_seek_position;
bool _pending_seek_accurate;
- bool _suspended;
+ int _suspended;
bool _finished;
bool _died;
bool _stop_thread;