mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 12:44:40 +03:00
see #2: update std::atomic and memory model
This commit is contained in:
12
code/7/7.7.is.lock.free.cpp
Normal file
12
code/7/7.7.is.lock.free.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
|
||||
struct A {
|
||||
float x;
|
||||
int y;
|
||||
long long z;
|
||||
};
|
||||
std::atomic<A> a;
|
||||
std::cout << std::boolalpha << a.is_lock_free() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user