mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-07 05:08:51 -04:00
generalization
This commit is contained in:
parent
9b0a9b7ad2
commit
95e7f6a59e
8 changed files with 174 additions and 104 deletions
|
|
@ -4,19 +4,23 @@ public interface Future<R> {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
default R poll(Waker waker){
|
||||
return (R) Pending.INSTANCE;
|
||||
return (R)Pending.INSTANCE;
|
||||
}
|
||||
|
||||
default R await(){
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("NO!");
|
||||
}
|
||||
|
||||
static <R> Future<R> ret(R r){
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("NO!");
|
||||
}
|
||||
|
||||
static void yield() {
|
||||
throw new RuntimeException("NO!");
|
||||
}
|
||||
|
||||
final class Pending{
|
||||
private static final Pending INSTANCE = new Pending();
|
||||
public static final Pending INSTANCE = new Pending();
|
||||
private Pending(){}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue