Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
typon-concurrency
Commits
07a28262
Commit
07a28262
authored
Jun 06, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Async (formerly Future) into Forked
parent
8ad73d26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
rt/include/typon/core/fork.hpp
rt/include/typon/core/fork.hpp
+2
-2
rt/include/typon/core/forked.hpp
rt/include/typon/core/forked.hpp
+25
-25
rt/include/typon/typon.hpp
rt/include/typon/typon.hpp
+1
-1
No files found.
rt/include/typon/core/fork.hpp
View file @
07a28262
...
...
@@ -4,8 +4,8 @@
#include <coroutine>
#include <cstdint>
#include <typon/core/async.hpp>
#include <typon/core/continuation.hpp>
#include <typon/core/forked.hpp>
#include <typon/core/result.hpp>
#include <typon/core/scheduler.hpp>
...
...
@@ -102,7 +102,7 @@ namespace typon
{
continuation
.
children
().
insert
(
_coroutine
);
}
return
Async
<
T
>
(
_coroutine
,
!
stolen
);
return
Forked
<
T
>
(
_coroutine
,
!
stolen
);
}
};
...
...
rt/include/typon/core/
async
.hpp
→
rt/include/typon/core/
forked
.hpp
View file @
07a28262
#ifndef TYPON_CORE_
ASYNC
_HPP_INCLUDED
#define TYPON_CORE_
ASYNC
_HPP_INCLUDED
#ifndef TYPON_CORE_
FORKED
_HPP_INCLUDED
#define TYPON_CORE_
FORKED
_HPP_INCLUDED
#include <coroutine>
#include <memory>
...
...
@@ -15,7 +15,7 @@ namespace typon
{
template
<
typename
T
>
struct
Async
struct
Forked
{
using
value_type
=
T
;
...
...
@@ -26,7 +26,7 @@ namespace typon
};
template
<
typename
Promise
>
Async
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
Forked
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
{
if
(
ready
)
{
...
...
@@ -39,7 +39,7 @@ namespace typon
}
}
Async
(
Async
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible_v
<
T
>
)
Forked
(
Forked
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible_v
<
T
>
)
{
_result
=
other
.
_result
;
if
(
!
_result
)
...
...
@@ -48,12 +48,12 @@ namespace typon
}
}
Async
&
operator
=
(
Async
&&
other
)
Forked
&
operator
=
(
Forked
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible_v
<
T
>
)
{
if
(
this
!=
&
other
)
{
Async
old
{
std
::
move
(
*
this
)
};
Forked
old
{
std
::
move
(
*
this
)
};
_result
=
other
.
_result
;
if
(
!
_result
)
{
...
...
@@ -63,7 +63,7 @@ namespace typon
return
*
this
;
}
~
Async
()
~
Forked
()
{
if
(
!
_result
)
{
...
...
@@ -84,7 +84,7 @@ namespace typon
template
<
typename
T
>
requires
requires
{
sizeof
(
T
);
}
&&
(
sizeof
(
T
)
>
2
*
sizeof
(
void
*
))
struct
Async
<
T
>
struct
Forked
<
T
>
{
using
value_type
=
T
;
...
...
@@ -92,7 +92,7 @@ namespace typon
std
::
coroutine_handle
<>
_coroutine
;
template
<
typename
Promise
>
Async
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
Forked
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
{
_result
=
&
(
coroutine
.
promise
());
if
(
ready
)
...
...
@@ -105,22 +105,22 @@ namespace typon
}
}
Async
(
const
Async
&
)
=
delete
;
Async
&
operator
=
(
const
Async
&
)
=
delete
;
Forked
(
const
Forked
&
)
=
delete
;
Forked
&
operator
=
(
const
Forked
&
)
=
delete
;
Async
(
Async
&&
other
)
noexcept
Forked
(
Forked
&&
other
)
noexcept
:
_result
(
other
.
_result
)
,
_coroutine
(
std
::
exchange
(
other
.
_coroutine
,
nullptr
))
{}
Async
&
operator
=
(
Async
&&
other
)
noexcept
Forked
&
operator
=
(
Forked
&&
other
)
noexcept
{
std
::
swap
(
_coroutine
,
other
.
_coroutine
);
std
::
swap
(
_result
,
other
.
_result
);
return
*
this
;
}
~
Async
()
~
Forked
()
{
if
(
_coroutine
)
{
...
...
@@ -137,7 +137,7 @@ namespace typon
template
<
typename
T
>
requires
std
::
is_trivially_copyable_v
<
T
>
struct
Async
<
T
>
struct
Forked
<
T
>
{
using
value_type
=
T
;
...
...
@@ -148,7 +148,7 @@ namespace typon
};
template
<
typename
Promise
>
Async
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
Forked
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
{
if
(
ready
)
{
...
...
@@ -161,10 +161,10 @@ namespace typon
}
}
Async
(
Async
&&
other
)
=
default
;
Async
&
operator
=
(
Async
&&
other
)
=
default
;
Forked
(
Forked
&&
other
)
=
default
;
Forked
&
operator
=
(
Forked
&&
other
)
=
default
;
~
Async
()
~
Forked
()
{
if
(
!
_result
)
{
...
...
@@ -184,7 +184,7 @@ namespace typon
template
<
typename
T
>
struct
Async
<
T
&>
struct
Forked
<
T
&>
{
using
value_type
=
T
&
;
...
...
@@ -192,7 +192,7 @@ namespace typon
T
*
_value
;
template
<
typename
Promise
>
Async
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
Forked
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
{
if
(
ready
)
{
...
...
@@ -217,14 +217,14 @@ namespace typon
template
<
>
struct
Async
<
void
>
struct
Forked
<
void
>
{
using
value_type
=
void
;
Result
<
void
>
*
_result
=
nullptr
;
template
<
typename
Promise
>
Async
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
Forked
(
std
::
coroutine_handle
<
Promise
>
coroutine
,
bool
ready
)
{
if
(
ready
)
{
...
...
@@ -249,4 +249,4 @@ namespace typon
}
#endif // TYPON_
ASYNC
_HPP_INCLUDED
#endif // TYPON_
FORKED
_HPP_INCLUDED
rt/include/typon/typon.hpp
View file @
07a28262
...
...
@@ -3,8 +3,8 @@
#include <utility>
#include <typon/core/async.hpp>
#include <typon/core/fork.hpp>
#include <typon/core/forked.hpp>
#include <typon/core/future.hpp>
#include <typon/core/join.hpp>
#include <typon/core/root.hpp>
...
...
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