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
substring search
gcc set_terminate
Microsoft Question - MaxEmployeeAttendence (original question)
maximum nights you can accommodate
string_match
data locality - fast example
A number is prime or not
Kolokwium_2011_z12
aju
Trace