Skip to content

Instantly share code, notes, and snippets.

@dburner
Created March 16, 2016 09:08
Show Gist options
  • Select an option

  • Save dburner/a1223c9968e50803b3f7 to your computer and use it in GitHub Desktop.

Select an option

Save dburner/a1223c9968e50803b3f7 to your computer and use it in GitHub Desktop.
C# Awaiter compiler implementation
// from http://stackoverflow.com/a/12661431/1317953
// By Stephen Cleary
var temp = e.GetAwaiter();
if (!temp.IsCompleted)
{
SAVE_STATE()
temp.OnCompleted(&cont);
return;
cont:
RESTORE_STATE()
}
var i = temp.GetResult();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment