Async and function implementation in C++