Skip to content

Instantly share code, notes, and snippets.

@heejune
Created Feb 19, 2017
Embed
What would you like to do?
future_async_methods
template<class _Ty>
bool await_ready(future<_Ty>& _Fut)
{
return (_Fut._Is_ready());
}
template<class _Ty>
void await_suspend(future<_Ty>& _Fut,
experimental::coroutine_handle<> _ResumeCb)
{ // change to .then when future gets .then
thread _WaitingThread([&_Fut, _ResumeCb]{
_Fut.wait();
_ResumeCb();
});
_WaitingThread.detach();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment