HikoGUI
Select Version:
main (latest dev)
0.8.1 (latest)
0.8.0
0.7.0
0.6.0
0.5.1
0.5.0
0.4.0
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0
theme-value
theme-tag
text
ranged-int
phrase-mask-chars
new-window-widget
msvs-bug-20230517
msvs-bug-20230503
msvs-bug-20230428
msvc-c1001-20231106
msvc-bug-20230706
msvc-bug-20221214
modules-part1
label-delegate
bug-msvs-20220928
attribute-parser
⚠️ This documents the
main
development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Variables
c
d
g
i
l
o
p
r
s
t
x
Typedefs
Enumerations
a
b
c
d
f
g
h
k
l
p
s
t
u
v
w
Concepts
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Related Symbols
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
Files
File List
Globals
All
Functions
Macros
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
src
hikogui
dispatch
awaitable_stop_token_intf.hpp
1
// Copyright Take Vos 2023.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "awaitable.hpp"
8
#include "../concurrency/concurrency.hpp"
9
#include "../time/time.hpp"
10
#include "../macros.hpp"
11
#include <chrono>
12
#include <coroutine>
13
#include <functional>
14
#include <stop_token>
15
16
hi_export_module(hikogui.dispatch : awaitable_stop_token_intf);
17
18
hi_export
namespace
hi::inline
v1
{
19
class
loop;
20
21
class
awaitable_stop_token
{
22
public
:
23
awaitable_stop_token
(
awaitable_stop_token
&&)
noexcept
=
default
;
24
awaitable_stop_token
&operator=(
awaitable_stop_token
&&)
noexcept
=
default
;
25
26
awaitable_stop_token
(
awaitable_stop_token
const
&other) noexcept : _stop_token(other._stop_token), _stop_callback_ptr() {}
27
28
awaitable_stop_token
&operator=(
awaitable_stop_token
const
&other)
noexcept
29
{
30
_stop_callback_ptr =
nullptr
;
31
_stop_token = other._stop_token;
32
return
*
this
;
33
}
34
35
awaitable_stop_token
(std::stop_token
const
&stop_token) noexcept : _stop_token(stop_token), _stop_callback_ptr()
36
{
37
}
38
39
[[nodiscard]]
bool
await_ready()
const
noexcept
40
{
41
return
_stop_token.stop_requested();
42
}
43
44
void
await_suspend(std::coroutine_handle<> handle)
noexcept
;
45
46
void
await_resume()
noexcept
{
47
_stop_callback_ptr =
nullptr
;
48
}
49
50
private
:
51
struct
callback_wrapper {
52
void
operator()()
noexcept
;
53
54
loop
*await_loop;
55
std::coroutine_handle<> handle;
56
};
57
58
std::stop_token _stop_token;
59
std::unique_ptr<std::stop_callback<callback_wrapper>
> _stop_callback_ptr;
60
};
21
class
awaitable_stop_token
{
…
};
61
62
template
<>
63
struct
awaitable_cast
<
std
::stop_token> {
64
template
<
typename
RHS>
65
decltype
(
auto
)
operator
()(RHS&& rhs)
noexcept
66
{
67
return
awaitable_stop_token
{std::forward<RHS>(rhs)};
68
}
69
};
63
struct
awaitable_cast
<
std
::stop_token> {
…
};
70
71
}
// namespace hi::inline v1
std
STL namespace.
v1
DOXYGEN BUG.
Definition
algorithm_misc.hpp:20
v1::awaitable_cast
Definition
awaitable.hpp:41
v1::awaitable_stop_token
Definition
awaitable_stop_token_intf.hpp:21
v1::loop
Definition
loop_win32_intf.hpp:32
std::unique_ptr
Generated on Mon Apr 22 2024 12:51:34 for HikoGUI by
1.10.0