xrpld
Loading...
Searching...
No Matches
nix
docker
test_files
cpp_sources
tsan.cpp
1
#include <
iostream
>
2
#include <
thread
>
3
4
static
int
kCounter = 0;
5
6
void
7
increment()
8
{
9
for
(
int
i = 0; i < 100'000; ++i)
10
{
11
++kCounter;
12
}
13
}
14
15
int
16
main()
17
{
18
std::thread
t1(increment);
19
std::thread
t2(increment);
20
21
t1.join();
22
t2.join();
23
24
std::cout
<<
"Final counter value: "
<< kCounter <<
std::endl
;
25
return
0;
26
}
std::cout
std::endl
T endl(T... args)
iostream
thread
Generated by
1.16.1