mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-06 21:00:35 -04:00
26 lines
525 B
Java
26 lines
525 B
Java
package generator.future;
|
|
|
|
public interface Future<R> {
|
|
|
|
@SuppressWarnings("unchecked")
|
|
default R poll(Waker waker){
|
|
return (R)Pending.INSTANCE;
|
|
}
|
|
|
|
default R await(){
|
|
throw new RuntimeException("NO!");
|
|
}
|
|
|
|
static <R> Future<R> ret(R r){
|
|
throw new RuntimeException("NO!");
|
|
}
|
|
|
|
static void yield() {
|
|
throw new RuntimeException("NO!");
|
|
}
|
|
|
|
final class Pending{
|
|
public static final Pending INSTANCE = new Pending();
|
|
private Pending(){}
|
|
}
|
|
}
|