mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 16:26:48 +00:00
Co-authored-by: semgrep-companion-app[bot] <218312740+semgrep-companion-app[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
27 lines
347 B
C++
27 lines
347 B
C++
#include <iostream>
|
|
#include <thread>
|
|
|
|
static int kCounter = 0;
|
|
|
|
void
|
|
increment()
|
|
{
|
|
for (int i = 0; i < 100'000; ++i)
|
|
{
|
|
++kCounter;
|
|
}
|
|
}
|
|
|
|
int
|
|
main()
|
|
{
|
|
std::thread t1(increment);
|
|
std::thread t2(increment);
|
|
|
|
t1.join();
|
|
t2.join();
|
|
|
|
std::cout << "Final counter value: " << kCounter << std::endl;
|
|
return 0;
|
|
}
|