int operator()(future<int> msg) { int id = Futures_Id(); std::cout << "Waiting for future on " << id << endl; return msg.get(); };
HPX_FORCEINLINE result_type operator()(future<Derived> f) const { return f.get().share(); }
void worker1(future<int> fut) { printf("this is thread1\n"); flag = 1; fut.get(); printf("thread1 exit\n"); }
int future_int_f2(future<int> f1, future<int> f2) { HPX_TEST(f1.is_ready()); HPX_TEST(f2.is_ready()); ++future_int_f2_count; return f1.get() + f2.get(); }
void operator()(future<double> r) const { global_scratch += r.get(); }
tuple_type promiseTupleData(future<tuple_type>& f) { tuple_type t = f.get(); get<0>(t) += 20; get<1>(t) += " completed"; return t; }
naming::id_type return_id_type(future<bool> f, naming::id_type id) { f.get(); //re-throw any errors return id; }
void work1(future<int> fut) { printf("this is thread1\n"); flag = 1; fut.get(); //线程1阻塞至线程2设置共享状态 printf("thread1 exit\n"); }
std::vector<T> on_ready(future<void> f) { f.get(); // propagate any exceptions return std::move(data_); }