GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing www.tutorialspoint.com — C++ Library - <stdatomic>
Selected Reading
C++ Library - <stdatomic>The <stdatomic> header in C++, provides a set of functions to perform atomic operations on shared variables, to enable thread-safe manipulation of data. This header is part of the concurrency support library. The <stdatomic> header shall define the atomic_flag type as a structure type (provides the classic test-and-set functionality) having two states, set and clear. Including <stdatomic> HeaderTo include the <stdatomic> header in your C++ program, you can use the following syntax. #include <stdatomic> Functions of <stdatomic> HeaderBelow is list of all functions from <stdatomic> header. Path Manipulation FunctionsThis path manipulation functions operate on file paths to compose, convert or resolve them.
Checking if Operations are Lock-FreeIn the below example we are going to use, atomic_is_lock_free to check if atomic operations on a specific atomic type are lock-free. #include <iostream>
#include <atomic>
int main() {
std::atomic<int> atomicInt;
bool isLockFree = atomic_is_lock_free(&atomicInt);
std::cout << "Is atomic operation lock-free? " << std::boolalpha << isLockFree << std::endl;
return 0;
}
OutputIf we run the above code it will generate the following output Is atomic operation lock-free? true Advertisements
| ||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |