use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableObject.
@Test
public void testSkipForwardsToSuspendableObject() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableObject();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableObject"));
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableFloat.
@Test
public void testSkipForwardsToSuspendableFloat() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableFloat();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableFloat"));
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableVoid.
@Test
public void testSkipForwardsToSuspendableVoid() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableVoid();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableVoid"));
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableDouble.
@Test
public void testSkipForwardsToSuspendableDouble() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableDouble();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableDouble"));
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class TransferSelectorTest method testSelectSendWithClose2.
@Test
public void testSelectSendWithClose2() throws Exception {
final Channel<String> channel1 = newChannel();
final Channel<String> channel2 = newChannel();
final Channel<String> channel3 = newChannel();
Fiber fib = new Fiber("fiber", scheduler, new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
Strand.sleep(200);
SelectAction<String> sa1 = select(send(channel1, "hi1"), send(channel2, "hi2"), send(channel3, "hi3"));
Strand.sleep(200);
SelectAction<String> sa2 = select(send(channel1, "hi1"), send(channel2, "hi2"), send(channel3, "hi3"));
assertThat(sa1.index(), is(1));
assertThat(sa2.index(), is(1));
}
}).start();
channel2.close();
fib.join();
}
Aggregations