Last active
April 18, 2017 22:04
-
-
Save matrixd/7fb05fef38eeabe6c1173ca065679a79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <thread> | |
| #include <chrono> | |
| #include <future> | |
| int main() | |
| { | |
| auto future = std::async(std::launch::async, [] | |
| { | |
| using namespace std::chrono_literals; | |
| std::this_thread::sleep_for(2s); | |
| std::cout << "sleepy thread... zzZZzz..." << std::endl; | |
| } | |
| ); | |
| std::cout << "healthy thread" << std::endl; | |
| using namespace std::chrono_literals; | |
| std::this_thread::sleep_for(7s); | |
| std::cout << "healthy thread has slept for 7s" << std::endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment