Improve base::binary_guard interface.

This commit is contained in:
John Preston
2019-03-27 16:11:38 +04:00
parent efb2972d28
commit d3bf489bea
12 changed files with 38 additions and 54 deletions
@@ -268,7 +268,6 @@ ConcurrentTimer::ConcurrentTimer(
}
Fn<void()> ConcurrentTimer::createAdjuster() {
auto guards = base::make_binary_guard();
_guard = std::make_shared<bool>(true);
return [=, runner = _runner, guard = std::weak_ptr<bool>(_guard)] {
runner([=] {
@@ -294,12 +293,10 @@ void ConcurrentTimer::start(
}
void ConcurrentTimer::cancelAndSchedule(int timeout) {
auto guards = base::make_binary_guard();
_running = std::move(guards.first);
auto method = [
=,
runner = _runner,
guard = std::move(guards.second)
guard = _running.make_guard()
]() mutable {
if (!guard) {
return;