mirror of
https://github.com/ParkerTenBroeck/coroutines.git
synced 2026-06-06 21:00:35 -04:00
testing
This commit is contained in:
parent
24ea55603e
commit
487723713a
2 changed files with 15 additions and 2 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
|
import async_runtime.Delay;
|
||||||
import async_runtime.Jokio;
|
import async_runtime.Jokio;
|
||||||
import generators.RT;
|
import generators.RT;
|
||||||
import future.Future;
|
import future.Future;
|
||||||
import future.Waker;
|
import future.Waker;
|
||||||
import gen.Gen;
|
import gen.Gen;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class Main implements Runnable {
|
public class Main implements Runnable {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
RT.runWithGeneratorSupport(Main.class);
|
RT.runWithGeneratorSupport(Main.class);
|
||||||
|
|
@ -11,8 +14,14 @@ public class Main implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// await();
|
lambda(() -> {
|
||||||
|
System.out.println("START");
|
||||||
|
Delay.delay(100).await();
|
||||||
|
System.out.println("END");
|
||||||
|
return Future.ret();
|
||||||
|
});
|
||||||
lexer();
|
lexer();
|
||||||
|
await();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,6 +29,10 @@ public class Main implements Runnable {
|
||||||
new Jokio().blocking(AsyncExamples.test());
|
new Jokio().blocking(AsyncExamples.test());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lambda(Supplier<Future<?, ?>> lambda){
|
||||||
|
new Jokio().blocking(lambda.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void lexer(){
|
void lexer(){
|
||||||
var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)");
|
var gen = Lexer.parse("f7(x,y,z,w, u,v, othersIg) = v-(x*y+y+ln(z)^2*sin(z*pi/2))/(w*u)+sqrt(othersIg*120e-1)");
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class Jokio implements Runnable{
|
||||||
private final HashSet<Task<?, ?>> wokeSet = new HashSet<>();
|
private final HashSet<Task<?, ?>> wokeSet = new HashSet<>();
|
||||||
private final HashSet<Task<?, ?>> currentSet = new HashSet<>();
|
private final HashSet<Task<?, ?>> currentSet = new HashSet<>();
|
||||||
|
|
||||||
public void blocking(Future<?, RuntimeException> fut){
|
public void blocking(Future<?, ?> fut){
|
||||||
spawn(fut).run();
|
spawn(fut).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue