[libc] Add a class "Atomic" as a simple equivalent of std::atomic.
authorSiva Chandra Reddy <sivachandra@google.com>
Sun, 27 Feb 2022 22:15:21 +0000 (22:15 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Mon, 28 Feb 2022 23:51:44 +0000 (23:51 +0000)
commit11372555850fe782b81dc419fbb09e6fc718c94d
treeb598e832accdffdc742c3c7a4996466d01b5ca97
parent4d5bcff3be68fdded42ede34e1927359296b89d4
[libc] Add a class "Atomic" as a simple equivalent of std::atomic.

Only the methods currently required by the libc have been added.
Most of the existing uses of atomic operations have been switched over
to this new class. A future change will clean up the rest of uses.

This change now allows building mutex and condition variable code with a
C++ compiler which does not have stdatomic.h, for example g++.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D120642
libc/include/__llvm-libc-common.h
libc/include/llvm-libc-types/cnd_t.h
libc/include/llvm-libc-types/mtx_t.h
libc/src/__support/CPP/CMakeLists.txt
libc/src/__support/CPP/atomic.h [new file with mode: 0644]
libc/src/threads/linux/CMakeLists.txt
libc/src/threads/linux/CndVar.h
libc/src/threads/linux/Mutex.h
libc/test/src/__support/CPP/CMakeLists.txt
libc/test/src/__support/CPP/atomic_test.cpp [new file with mode: 0644]