[stopsource.mem] # 32 Concurrency support library [[thread]](./#thread) ## 32.3 Stop tokens [[thread.stoptoken]](thread.stoptoken#stopsource.mem) ### 32.3.5 Class stop_source [[stopsource]](stopsource#mem) #### 32.3.5.3 Member functions [stopsource.mem] [🔗](#lib:swap,stop_source) `void swap(stop_source& rhs) noexcept; ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L976) *Effects*: Equivalent to:*stop-state*.swap(rhs.*stop-state*); [🔗](#lib:get_token,stop_source) `stop_token get_token() const noexcept; ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L990) *Returns*: stop_token() if stop_possible() is false; otherwise a new associated stop_token object; i.e., its *stop-state* member is equal to the *stop-state* member of *this[.](#2.sentence-1) [🔗](#lib:stop_possible,stop_source) `bool stop_possible() const noexcept; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1004) *Returns*: *stop-state* != nullptr[.](#3.sentence-1) [🔗](#lib:stop_requested,stop_source) `bool stop_requested() const noexcept; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1015) *Returns*: true if *stop-state* refers to a stop state that has received a stop request; otherwise, false[.](#4.sentence-1) [🔗](#lib:request_stop,stop_source) `bool request_stop() noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1028) *Effects*: Executes a stop request operation ([[stoptoken.concepts]](stoptoken.concepts "32.3.3 Stop token concepts")) on the associated stop state, if any[.](#5.sentence-1)