Namespaces
Variants

std::shared_lock<Mutex>:: 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
shared_lock & operator = ( shared_lock && other ) noexcept ;
(C++14 이후)

이동 할당 연산자. 다음 코드와 동일합니다: shared_lock { std :: move ( other ) } . swap ( * this ) ; return * this ; .

만약 other * this 와 동일한 객체라면, 아무런 효과도 발생하지 않습니다.

그렇지 않고, 이 호출 이전에 * this 가 연결된 뮤텍스를 가지고 있고(( mutex() 가 null이 아닌 포인터를 반환) 그에 대한 소유권을 획득한 경우( owns() true 를 반환), unlock_shared() 를 호출하여 뮤텍스가 잠금 해제됩니다. 이 호출 이후, other 는 연결된 뮤텍스가 없습니다.

매개변수

other - 상태를 대체할 또 다른 shared_lock

반환값

* this

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 4172 C++14 shared_lock 의 자기 이동 대입이 잘못 명시됨 아무 작업도 수행하지 않도록 재명시