Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double do_sth(int n){
- double result = 0.;
- hpx::cout << "hpx_thread = " << std::hex
- << hpx::this_thread::get_id()
- << " os_thread = " << std::hex
- << std::this_thread::get_id() << std::endl;
- for(int i = 0; i<n; ++i){
- result = ((result + 1.)*result)/(result - 0.8*result);
- }
- return result;
- }
- int main(int argc, char* argv[])
- {
- int my_argc = 1;
- char** my_argv = new char*[my_argc];
- my_argv[0] = const_cast<char *>(std::string("parallel_for_").c_str());
- hpx::start(nullptr, my_argc, my_argv);
- hpx::future<double> result_f = hpx::async(&do_sth, 500);
- hpx::cout << "Result = " << result_f.get();
- return hpx::stop();
- }
Advertisement
Add Comment
Please, Sign In to add comment