9 #define mysleep Sleep(2000);
11 #define mysleep usleep(2000);
17 std::vector<int> state;
18 std::vector<int>::iterator it;
19 std::vector<bool> isAvailable;
23 this->it = this->state.begin();
26 void called_from_async()
29 std::cout << "called from async" << std::endl;
30 this->state.insert(this->it ,10);
33 std::string returned_from_async() {
39 void print_results(ASYNC &f)
41 std::string result = f.get();
42 std::cout << result.c_str() << std::endl;
47 return this->state.at(pos);
52 return this->state.size();
58 std::future<void> result(std::async(&Test::called_from_async, &test));
60 auto f1 = std::async(std::launch::async, &Test::returned_from_async, &test);
62 std::cout << "Message from main." << std::endl;
65 std::cout << test.getStateSize();
66 } while (test.getStateSize()<1);
70 std::cout << "wait for close";