atomic_atomic_is_lock_free
atomic_atomic_is_lock_free (락 프리 여부 확인)
std::atomic_is_lock_free는 주어진 원자적 객체에 대한 연산이 잠금 없이(lock-free) 수행되는지 알려줘요.
출처: cppreference
본문
std::atomic_is_lock_free는 <atomic> 헤더에 정의된 자유 함수예요.
template< class T >
bool atomic_is_lock_free( const std::atomic<T>* obj ) noexcept;
obj->is_lock_free()처럼 동작해요. 객체에 대한 원자적 연산이 락 프리로 구현되어 있으면 true를 반환해요.
반환값 (Return value)
락 프리이면 true, 아니면 false.
예제 (Example)
#include <atomic>
#include <iostream>
std::atomic<int> a;
int main()
{
std::cout << std::boolalpha << std::atomic_is_lock_free(&a) << '\n';
}