Last active
July 24, 2020 12:19
-
-
Save gabrielkirsten/ee03f6f895a9e18f32504122a4a1a2e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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