Commit 35bcc206 authored by Xavier Thompson's avatar Xavier Thompson

Adapt test programs

parent 1e6161c9
......@@ -25,7 +25,7 @@ Join<void> fail_join() {
}
Join<void> join(int max) {
std::vector<Future<core::Fork<int>::promise_type>> v;
std::vector<Future<Fork<int>::promise_type>> v;
for (int i = 0; i < max; i++) {
v.push_back(co_await fork(fib()));
}
......
......@@ -2,7 +2,7 @@
#include <cstdio>
using namespace typon::core;
using namespace typon;
Task<int> fibo(int n) {
if (n < 2) {
......
......@@ -14,7 +14,7 @@ Task<void> hello(int i) {
int n = fibo(10);
(void) i;
(void) n;
printf("hello from %d on %u, fibo(40) = %d\n", i, core::Scheduler::thread_id, n);
printf("hello from %d on %u, fibo(40) = %d\n", i, Scheduler::thread_id, n);
// printf("hello from %d on %lu, fibo(40) = %d\n", i, riften::detail::static_id, n);
co_return;
}
......@@ -22,24 +22,24 @@ Task<void> hello(int i) {
Join<void> parallel() {
for (int i = 0; i < 30; i++) {
co_await fork(hello(i));
printf("parallel resumed on %u\n", core::Scheduler::thread_id);
printf("parallel resumed on %u\n", Scheduler::thread_id);
// printf("parallel resumed on %lu\n", riften::detail::static_id);
}
printf("parallel syncing on %u\n", core::Scheduler::thread_id);
printf("parallel syncing on %u\n", Scheduler::thread_id);
// printf("parallel syncing on %lu\n", riften::detail::static_id);
co_await Sync();
printf("parallel resumed on %u\n", core::Scheduler::thread_id);
printf("parallel resumed on %u\n", Scheduler::thread_id);
// printf("parallel resumed on %lu\n", riften::detail::static_id);
for (int i = 30; i < 60; i++) {
co_await fork(hello(i));
printf("parallel resumed on %u\n", core::Scheduler::thread_id);
printf("parallel resumed on %u\n", Scheduler::thread_id);
// printf("parallel resumed on %lu\n", riften::detail::static_id);
}
}
Root root() {
co_await parallel();
printf("root resumed on %u\n", core::Scheduler::thread_id);
printf("root resumed on %u\n", Scheduler::thread_id);
}
int main() {
......
......@@ -8,8 +8,8 @@ Join<int> fibo(int n) {
if (n < 2) {
co_return n;
}
core::Future a = co_await fork(fibo(n - 1));
core::Future b = co_await fork(fibo(n - 2));
Future a = co_await fork(fibo(n - 1));
Future b = co_await fork(fibo(n - 2));
co_await Sync();
co_return a.get() + b.get();
}
......
......@@ -2,7 +2,7 @@
#include <cstdio>
using namespace typon::core;
using namespace typon;
Task<int> add(int a, int b) {
co_return a + b;
......
......@@ -2,7 +2,7 @@
#include <cstdio>
using namespace typon::core;
using namespace typon;
Task<int> fibo(int n) {
if (n < 2) {
......
......@@ -5,7 +5,7 @@
using namespace typon;
Root root() {
printf("root resumed on %u\n", core::Scheduler::thread_id);
printf("root resumed on %u\n", Scheduler::thread_id);
co_return;
}
......
......@@ -2,7 +2,7 @@
#include <cstdio>
using namespace typon::core;
using namespace typon;
Task<int> add(int a, int b) {
printf("add(%d, %d)\n", a, b);
......
......@@ -2,7 +2,7 @@
#include <cstdio>
using namespace typon::core;
using namespace typon;
Task<int> add(int a, int b) {
co_return a + b;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment