Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <string>
- #include <iostream>
- #include <future>
- #include <thread>
- #include <Windows.h>
- using namespace std;
- int returnFunction(string temp) {
- while (true) {
- Sleep(2000);
- cout << ".";
- }
- return 4;
- }
- void main() {
- auto future = std::async(returnFunction, "test");
- int simple = future.get();
- cout << simple << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment