Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- #include <atomic>
- std::atomic<size_t> g_counter(0);
- void f() {
- for (auto i = 0; i < 100000; ++i) ++g_counter;
- if (false) return;
- }
- void f2() {}
- int main() {
- std::thread t1(f);
- std::thread t2(f);
- t1.join();
- t2.join();
- std::cout << g_counter << std::endl;
- return 0;
- }
- ///////////////////////////////////////////////////
- Name Regions Miss Cover Lines Miss Cover
- -----------------------------------------------------------------------------
- _Z1fv 5 1 80.00% 4 1 75.00%
- _Z2f2v 1 1 0.00% 1 1 0.00%
- main 1 0 100.00% 8 0 100.00%
- -----------------------------------------------------------------------------
- TOTAL 7 2 71.43% 13 2 84.62%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement