forked from dueca/dueca
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatomic_test.cxx
More file actions
29 lines (25 loc) · 739 Bytes
/
atomic_test.cxx
File metadata and controls
29 lines (25 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ------------------------------------------------------------------ */
/* item : atomic_test.cxx
made by : Rene' van Paassen
date : 210426
category : body file
description :
changes : 210426 first version
language : C++
copyright : (c) 21 TUDelft-AE-C&S
copyright : (c) 2022 René van Paassen
license : EUPL-1.2
*/
#define atomic_test_cxx
#include <atomic>
int main(int argc, char** argv)
{
uint64_t one;
std::atomic<uint64_t> two;
uint64_t tmp;
two = 2; one = 1; tmp = two;
if (!std::atomic_compare_exchange_strong(&two, &tmp, one)) {
return 1;
}
return 0;
}