Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
a45fcb61
Commit
a45fcb61
authored
May 10, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove forkjoin.cpp
parent
35bcc206
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
49 deletions
+0
-49
rt/test/forkjoin.cpp
rt/test/forkjoin.cpp
+0
-49
No files found.
rt/test/forkjoin.cpp
deleted
100644 → 0
View file @
35bcc206
#include <typon/typon.hpp>
#include <cstdio>
using
namespace
typon
;
int
fibo
(
int
n
)
{
if
(
n
<
2
)
return
n
;
return
fibo
(
n
-
1
)
+
fibo
(
n
-
2
);
}
Task
<
void
>
hello
(
int
i
)
{
int
n
=
fibo
(
10
);
(
void
)
i
;
(
void
)
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
;
}
Join
<
void
>
parallel
()
{
for
(
int
i
=
0
;
i
<
30
;
i
++
)
{
co_await
fork
(
hello
(
i
));
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
"
,
Scheduler
::
thread_id
);
// printf("parallel syncing on %lu\n", riften::detail::static_id);
co_await
Sync
();
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
"
,
Scheduler
::
thread_id
);
// printf("parallel resumed on %lu\n", riften::detail::static_id);
}
}
Root
root
()
{
co_await
parallel
();
printf
(
"root resumed on %u
\n
"
,
Scheduler
::
thread_id
);
}
int
main
()
{
root
().
call
();
puts
(
"done"
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment