Created
August 15, 2017 01:22
-
-
Save taeguk/58debce944df366ebd6a69b1906a1fcb to your computer and use it in GitHub Desktop.
aaa.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <thread> | |
#include <chrono> | |
#include <hpx/dataflow.hpp> | |
void haaam(int& i) | |
{ | |
using namespace std::chrono_literals; | |
std::this_thread::sleep_for(2s); | |
std::cout << "[haaam] start" << std::endl; | |
std::this_thread::sleep_for(2s); | |
std::cout << "[haaam] end" << std::endl; | |
std::cout << "[haaam] i = " << i << std::endl; | |
} | |
void test_for_2325() | |
{ | |
hpx::future<void> f; | |
{ | |
hpx::shared_future<int> i = hpx::make_ready_future(10).share(); | |
std::cout << "[main] before dataflow" << std::endl; | |
f = hpx::dataflow(hpx::launch::async, | |
hpx::util::unwrapping(&haaam), i); | |
std::cout << "[main] i = " << i.get() << std::endl; | |
} | |
{ | |
hpx::shared_future<int> i = hpx::make_ready_future(20).share(); | |
int a[111]; | |
} | |
{ | |
int a[11111]; | |
} | |
std::cout << "[main] out of scope " << std::endl; | |
f.get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://cpp.sh/4cjn6