Skip to content

Instantly share code, notes, and snippets.

@gabrielkirsten
Last active July 24, 2020 12:19
Show Gist options
  • Save gabrielkirsten/ee03f6f895a9e18f32504122a4a1a2e4 to your computer and use it in GitHub Desktop.
Save gabrielkirsten/ee03f6f895a9e18f32504122a4a1a2e4 to your computer and use it in GitHub Desktop.
public static final Object addTen(int n, Continuation continuation) {
switch (continuation.label) {
case 0: {
continuation.n = n;
continuation.label = 1;
if (delay(1000L, continuation) == COROUTINE_SUSPENDED)
return COROUTINE_SUSPENDED;
}
case 1: {
n = continuation.n;
}
default: {
throw new IllegalStateException();
}
}
return n + 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment