mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-30 09:11:43 +00:00
Improve base::binary_guard interface.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user