LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
timer.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "timer.h"
10#include <QTimer>
11
12namespace LC::Util::detail
13{
14 bool TimerAwaiter::await_ready () const noexcept
15 {
16 return false;
17 }
18
19 void TimerAwaiter::await_suspend (std::coroutine_handle<> handle) noexcept
20 {
21 QTimer::singleShot (Duration_, handle);
22 }
23
24 void TimerAwaiter::await_resume () const noexcept
25 {
26 }
27}
28
29namespace LC
30{
31 Util::detail::TimerAwaiter operator co_await (std::chrono::milliseconds duration)
32 {
33 return Util::detail::TimerAwaiter { duration, Qt::CoarseTimer };
34 }
35}
Definition constants.h:15
bool await_ready() const noexcept
Definition timer.cpp:14
void await_resume() const noexcept
Definition timer.cpp:24
void await_suspend(std::coroutine_handle<> handle) noexcept
Definition timer.cpp:19