#include <iostream>
#include <future>
#include <thread>
#include <chrono>

#define LOG()	std::cout << __func__ << " : "

void test()
{
	LOG() << "IN\n";
	
	using namespace std::chrono_literals;
	std::this_thread::sleep_for( 1s );
	
	LOG() << "OUT\n";
}

int main()
{
	LOG() << "Calling test()...\n";
	
	auto f = std::async( std::launch::async, test );
	
	LOG() << "Running test()...\n";
	
	// ...                             ...
	// ... You can do other stuff here ...
	// ...                             ...
	
	f.wait(); // Blocking call to wait for the result to be available
	
	LOG() << "Exiting...\n";
	
	return 0;
}