11 #define mysleep Sleep(2000);
13 #define mysleep usleep(2000);
19 std::vector<int> state;
20 std::vector<int>::iterator it;
21 std::vector<bool> isAvailable;
25 this->it = this->state.begin();
28 void called_from_async()
31 std::cout << "called from async" << std::endl;
32 this->state.insert(this->it ,10);
35 std::string returned_from_async() {
41 void print_results(ASYNC &f)
43 std::string result = f.get();
44 std::cout << result.c_str() << std::endl;
49 return this->state.at(pos);
54 return this->state.size();
60 std::future<void> result(std::async(&Test::called_from_async, &test));
62 auto f1 = std::async(std::launch::async, &Test::returned_from_async, &test);
64 std::cout << "Message from main." << std::endl;
67 std::cout << test.getStateSize();
68 } while (test.getStateSize()<1);
72 std::cout << "wait for close";