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
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
cython-plus
typon
Commits
1d137d44
Commit
1d137d44
authored
Jul 06, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test program leaked_future.cpp
parent
46e17962
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
rt/test/leaked_future.cpp
rt/test/leaked_future.cpp
+33
-0
No files found.
rt/test/leaked_future.cpp
0 → 100644
View file @
1d137d44
#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
<
int
>
producer
(
int
n
)
{
int
value
=
fibo
(
n
);
printf
(
"[%u] producing %d
\n
"
,
Scheduler
::
thread_id
,
value
);
co_return
value
;
}
Task
<
void
>
consumer
()
{
printf
(
"[%u] launching future
\n
"
,
Scheduler
::
thread_id
);
Future
f
=
co_await
future
(
producer
(
40
));
printf
(
"[%u] leaking future
\n
"
,
Scheduler
::
thread_id
);
}
Root
root
()
{
co_await
consumer
();
}
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