Created
June 11, 2017 20:21
-
-
Save PeterZhizhin/2a3faadb7afafd54a5004a33f3f5e7c0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#ifdef NOJUDGE | |
#include <iostream> | |
#include "test.cpp" | |
int func(int a, int b) | |
{ | |
std::this_thread::sleep_for(std::chrono::seconds(1)); | |
return a + b; | |
} | |
struct functor | |
{ | |
void operator()(int v) { | |
std::cout << v << std::endl; | |
} | |
}; | |
int main(int argc, char *argv[]) | |
{ | |
functor f; | |
async_launch(std::function<int (int, int)>(func), f, 2, 6); | |
std::this_thread::sleep_for(std::chrono::seconds(2)); | |
return 0; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment