Namespaces
Variants

std::jthread:: operator=

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
std:: jthread & operator = ( std:: jthread && other ) noexcept ;
(desde C++20)

Si * this todavía tiene un hilo asociado en ejecución (es decir, joinable ( ) == true ), llama a request_stop ( ) seguido de join ( ) . Asigna el estado de other a * this y establece other a un estado construido por defecto.

Después de esta llamada, this - > get_id ( ) es igual al valor de other. get_id ( ) previo a la llamada y el estado de parada asociado también se transfiere, y other ya no representa un hilo de ejecución ni tiene ningún estado de parada.

Parámetros

otro - otro objeto jthread para asignar a este objeto jthread

Valor de retorno

* this