mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-07 05:08:51 -04:00
organized, added futures
This commit is contained in:
parent
13d9ba7363
commit
6424548e75
8 changed files with 29 additions and 6 deletions
18
src/generator/future/Future.java
Normal file
18
src/generator/future/Future.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package generator.future;
|
||||
|
||||
public interface Future<R> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default R poll(Waker waker){
|
||||
return (R) Pending.INSTANCE;
|
||||
}
|
||||
|
||||
default R await(){
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
final class Pending{
|
||||
private static final Pending INSTANCE = new Pending();
|
||||
private Pending(){}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue