32
Concurrency support library
[thread]
32.3
Stop tokens
[thread.stoptoken]
32.3.4
Class
stop_
token
[stoptoken]
32.3.4.1
General
[stoptoken.general]
1
#
The class
stop_
token
models the concept
stoppable_
token
.
It shares ownership of its stop state, if any, with its associated
stop_
source
object (
[stopsource]
) and any
stop_
token
objects to which it compares equal
.
namespace
std
{
class
stop_token
{
public
:
template
<
class
CallbackFn
>
using
callback_type
=
stop_callback
<
CallbackFn
>
; stop_token
(
)
noexcept
=
default
;
//
[stoptoken.
mem]
, member functions
void
swap
(
stop_token
&
)
noexcept
;
bool
stop_requested
(
)
const
noexcept
;
bool
stop_possible
(
)
const
noexcept
;
bool
operator
=
=
(
const
stop_token
&
rhs
)
noexcept
=
default
;
private
:
shared_ptr
<
unspecified
>
stop-state
;
//
exposition only
}
;
}
2
#
stop-state
refers to the
stop_
token
's associated stop state
.
A
stop_
token
object is disengaged when
stop-state
is empty
.