Files
2025-10-25 03:02:53 +03:00

3.0 KiB

[stoptoken.inplace]

32 Concurrency support library [thread]

32.3 Stop tokens [thread.stoptoken]

32.3.8 Class inplace_stop_token [stoptoken.inplace]

32.3.8.1 General [stoptoken.inplace.general]

1

#

The class inplace_stop_token models the concept stoppable_token.

It references the stop state of its associated inplace_stop_source object ([stopsource.inplace]), if any.

namespace std {class inplace_stop_token {public:templateusing callback_type = inplace_stop_callback;

inplace_stop_token() = default; bool operator==(const inplace_stop_token&) const = default; // [stoptoken.inplace.mem], member functionsbool stop_requested() const noexcept; bool stop_possible() const noexcept; void swap(inplace_stop_token&) noexcept; private:const inplace_stop_source* stop-source = nullptr; // exposition only};}

32.3.8.2 Member functions [stoptoken.inplace.mem]

🔗

void swap(inplace_stop_token& rhs) noexcept;

1

#

Effects: Exchanges the values of stop-source and rhs.stop-source.

🔗

bool stop_requested() const noexcept;

2

#

Effects: Equivalent to:return stop-source != nullptr && stop-source->stop_requested();

3

#

[Note 1:

As specified in [basic.life], the behavior of stop_requested is undefined unless the call strongly happens before the start of the destructor of the associated inplace_stop_source object, if any.

— end note]

🔗

stop_possible() const noexcept;

4

#

Returns: stop-source != nullptr.

5

#

[Note 2:

As specified in [basic.stc.general], the behavior of stop_possible is implementation-defined unless the call strongly happens before the end of the storage duration of the associated inplace_stop_source object, if any.

— end note]