Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
f30013ae
Commit
f30013ae
authored
Aug 09, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added delayed_send_tuple and delayed_reply_tuple
parent
6b700713
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
11 deletions
+43
-11
cppa/cppa.hpp
cppa/cppa.hpp
+43
-11
No files found.
cppa/cppa.hpp
View file @
f30013ae
...
...
@@ -540,33 +540,65 @@ inline void forward_to(const actor_ptr& whom) {
/**
* @brief Sends a message to @p whom that is delayed by @p rel_time.
* @param whom Receiver of the message.
* @param rel_time Relative time duration to delay the message in
* @param rtime Relative time duration to delay the message in
* microseconds, milliseconds, seconds or minutes.
* @param what Message content as a tuple.
*/
template
<
class
Rep
,
class
Period
,
typename
...
Args
>
inline
void
delayed_send_tuple
(
const
channel_ptr
&
whom
,
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
rtime
,
any_tuple
what
)
{
if
(
whom
)
{
get_scheduler
()
->
delayed_send
(
whom
,
rtime
,
what
);
}
}
/**
* @brief Sends a message to @p whom that is delayed by @p rel_time.
* @param whom Receiver of the message.
* @param rtime Relative time duration to delay the message in
* microseconds, milliseconds, seconds or minutes.
* @param what Message elements.
*/
template
<
class
Rep
,
class
Period
,
typename
...
Args
>
inline
void
delayed_send
(
const
channel_ptr
&
whom
,
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
r
el_
time
,
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
rtime
,
Args
&&
...
what
)
{
static_assert
(
sizeof
...(
Args
)
>
0
,
"no message to send"
);
if
(
whom
)
{
get_scheduler
()
->
delayed_send
(
whom
,
rel_time
,
std
::
forward
<
Args
>
(
what
)...);
delayed_send_tuple
(
whom
,
rtime
,
make_any_tuple
(
std
::
forward
<
Args
>
(
what
)...));
}
}
/**
* @brief Sends a reply message that is delayed by @p rel_time.
* @param rel_time Relative time duration to delay the message in
* @param rtime Relative time duration to delay the message in
* microseconds, milliseconds, seconds or minutes.
* @param what Message content as a tuple.
* @see delayed_send()
*/
template
<
class
Rep
,
class
Period
,
typename
...
Args
>
inline
void
delayed_reply_tuple
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
rtime
,
any_tuple
what
)
{
get_scheduler
()
->
delayed_reply
(
self
->
last_sender
(),
rtime
,
self
->
get_response_id
(),
std
::
move
(
what
));
}
/**
* @brief Sends a reply message that is delayed by @p rel_time.
* @param rtime Relative time duration to delay the message in
* microseconds, milliseconds, seconds or minutes.
* @param what Message elements.
* @note Equal to <tt>delayed_send(self->last_sender(), rel_time, what...)</tt>.
* @see delayed_send()
*/
template
<
class
Rep
,
class
Period
,
typename
...
Args
>
inline
void
delayed_reply
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
r
el_
time
,
inline
void
delayed_reply
(
const
std
::
chrono
::
duration
<
Rep
,
Period
>&
rtime
,
Args
&&
...
what
)
{
delayed_send
(
self
->
last_sender
(),
rel_time
,
self
->
get_response_id
(),
std
::
forward
<
Args
>
(
what
)...);
delayed_reply_tuple
(
rtime
,
make_any_tuple
(
std
::
forward
<
Args
>
(
what
)...));
}
/** @} */
...
...
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