Esempio n. 1
0
TEST(Fibonacci, ComputesFibonacciSequence) {
    FiberSystem system;
    system.fiberize();

    auto fibonacciPar = system.future(fibonacciFuture);
    for (int i = 0; i < 100; ++i) {
        for (uint64_t n = 0; n <= 20; ++n) {
            EXPECT_EQ(fibonacci(n), fibonacciPar.copy().run(n).await().get());
        }
    }
}
Esempio n. 2
0
int main() {
    FiberSystem system;
    AnyFiberRef self = system.fiberize();
    system.subscribe(self);

    for (size_t i = 0; i < spawners; ++i) {
        system.run<Spawner>();
    }

    system.allFibersFinished().await();
    return 0;
}