Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test yield
// this_thread::yield example #include <iostream> #include <thread> #include <atomic> #include <chrono> std::atomic<bool> ready(false); int count(0); // test yield void count1s() { while (!ready) { ++count; std::this_thread::yield(); // if comment out this, will loop many time! } } int main () { std::thread test = std::thread(count1s); std::this_thread::sleep_for(std::chrono::seconds(1)); ready = true; test.join(); std::cout << count << '\n'; return 0; }
run
|
edit
|
history
|
help
0
inorder traversal
scemo dd
Shared lock
Shultz_Lab2.CPP
Kishan_template
kadane's algorithm 2
11340 v3.0
Search in a rotated sorted array two methods
Stream generalization
mine