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
a83e4230
Commit
a83e4230
authored
Mar 17, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate review feedback
parent
0777157c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
38 deletions
+38
-38
libcaf_core/caf/detail/profiled_send.hpp
libcaf_core/caf/detail/profiled_send.hpp
+9
-9
libcaf_core/test/mixin/sender.cpp
libcaf_core/test/mixin/sender.cpp
+29
-29
No files found.
libcaf_core/caf/detail/profiled_send.hpp
View file @
a83e4230
...
@@ -31,31 +31,31 @@
...
@@ -31,31 +31,31 @@
namespace
caf
::
detail
{
namespace
caf
::
detail
{
template
<
class
Self
,
class
Se
nder
,
class
Handle
,
class
...
Ts
>
template
<
class
Self
,
class
Se
lfHandle
,
class
Handle
,
class
...
Ts
>
void
profiled_send
(
Self
*
self
,
Se
nder
&&
sender
,
const
Handle
&
receiver
,
void
profiled_send
(
Self
*
self
,
Se
lfHandle
&&
src
,
const
Handle
&
dst
,
message_id
msg_id
,
std
::
vector
<
strong_actor_ptr
>
stages
,
message_id
msg_id
,
std
::
vector
<
strong_actor_ptr
>
stages
,
execution_unit
*
context
,
Ts
&&
...
xs
)
{
execution_unit
*
context
,
Ts
&&
...
xs
)
{
CAF_IGNORE_UNUSED
(
self
);
CAF_IGNORE_UNUSED
(
self
);
if
(
receiver
)
{
if
(
dst
)
{
auto
element
=
make_mailbox_element
(
std
::
forward
<
Se
nder
>
(
sender
),
msg_id
,
auto
element
=
make_mailbox_element
(
std
::
forward
<
Se
lfHandle
>
(
src
),
msg_id
,
std
::
move
(
stages
),
std
::
move
(
stages
),
std
::
forward
<
Ts
>
(
xs
)...);
std
::
forward
<
Ts
>
(
xs
)...);
CAF_BEFORE_SENDING
(
self
,
*
element
);
CAF_BEFORE_SENDING
(
self
,
*
element
);
receiver
->
enqueue
(
std
::
move
(
element
),
context
);
dst
->
enqueue
(
std
::
move
(
element
),
context
);
}
}
}
}
template
<
class
Self
,
class
Se
nder
,
class
Handle
,
class
...
Ts
>
template
<
class
Self
,
class
Se
lfHandle
,
class
Handle
,
class
...
Ts
>
void
profiled_send
(
Self
*
self
,
Se
nder
&&
sender
,
const
Handle
&
dst
,
void
profiled_send
(
Self
*
self
,
Se
lfHandle
&&
src
,
const
Handle
&
dst
,
actor_clock
&
clock
,
actor_clock
::
time_point
timeout
,
actor_clock
&
clock
,
actor_clock
::
time_point
timeout
,
message_id
msg_id
,
Ts
&&
...
xs
)
{
message_id
msg_id
,
Ts
&&
...
xs
)
{
CAF_IGNORE_UNUSED
(
self
);
CAF_IGNORE_UNUSED
(
self
);
if
(
dst
)
{
if
(
dst
)
{
if
constexpr
(
std
::
is_same
<
Handle
,
group
>::
value
)
{
if
constexpr
(
std
::
is_same
<
Handle
,
group
>::
value
)
{
clock
.
schedule_message
(
timeout
,
dst
,
std
::
forward
<
Se
nder
>
(
sender
),
clock
.
schedule_message
(
timeout
,
dst
,
std
::
forward
<
Se
lfHandle
>
(
src
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
}
else
{
}
else
{
auto
element
=
make_mailbox_element
(
std
::
forward
<
Se
nder
>
(
sender
),
msg_id
,
auto
element
=
make_mailbox_element
(
std
::
forward
<
Se
lfHandle
>
(
src
),
msg_id
,
no_stages
,
std
::
forward
<
Ts
>
(
xs
)...);
no_stages
,
std
::
forward
<
Ts
>
(
xs
)...);
CAF_BEFORE_SENDING_SCHEDULED
(
self
,
timeout
,
*
element
);
CAF_BEFORE_SENDING_SCHEDULED
(
self
,
timeout
,
*
element
);
clock
.
schedule_message
(
timeout
,
actor_cast
<
strong_actor_ptr
>
(
dst
),
clock
.
schedule_message
(
timeout
,
actor_cast
<
strong_actor_ptr
>
(
dst
),
...
...
libcaf_core/test/mixin/sender.cpp
View file @
a83e4230
...
@@ -41,6 +41,8 @@ struct fixture : test_coordinator_fixture<> {
...
@@ -41,6 +41,8 @@ struct fixture : test_coordinator_fixture<> {
group
grp
;
group
grp
;
actor
testee
;
actor
testee
;
std
::
string
hello
=
"hello world"
;
fixture
()
{
fixture
()
{
grp
=
sys
.
groups
().
anonymous
();
grp
=
sys
.
groups
().
anonymous
();
testee
=
sys
.
spawn_in_group
(
grp
,
testee_impl
);
testee
=
sys
.
spawn_in_group
(
grp
,
testee_impl
);
...
@@ -56,49 +58,47 @@ struct fixture : test_coordinator_fixture<> {
...
@@ -56,49 +58,47 @@ struct fixture : test_coordinator_fixture<> {
CAF_TEST_FIXTURE_SCOPE
(
sender_tests
,
fixture
)
CAF_TEST_FIXTURE_SCOPE
(
sender_tests
,
fixture
)
CAF_TEST
(
delayed
actor
messages
receive
responses
)
{
CAF_TEST
(
delayed
actor
messages
receive
responses
)
{
self
->
delayed_send
(
testee
,
seconds
(
1
),
"hello world"
);
self
->
delayed_send
(
testee
,
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
hello
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
scheduled_send
(
testee
,
self
->
clock
().
now
()
+
seconds
(
1
),
"hello world"
);
self
->
scheduled_send
(
testee
,
self
->
clock
().
now
()
+
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
hello
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
}
}
CAF_TEST
(
delayed
group
message
receive
responses
)
{
CAF_TEST
(
delayed
group
message
receive
responses
)
{
self
->
delayed_send
(
grp
,
seconds
(
1
),
"hello world"
);
self
->
delayed_send
(
grp
,
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
hello
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
scheduled_send
(
grp
,
self
->
clock
().
now
()
+
seconds
(
1
),
"hello world"
);
self
->
scheduled_send
(
grp
,
self
->
clock
().
now
()
+
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
self
).
to
(
testee
).
with
(
hello
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
expect
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
}
}
CAF_TEST
(
anonymous
messages
receive
no
response
)
{
CAF_TEST
(
anonymous
messages
receive
no
response
)
{
self
->
anon_send
(
testee
,
"hello world"
);
self
->
anon_send
(
testee
,
hello
);
expect
((
std
::
string
),
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
to
(
testee
).
with
(
hello
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
delayed_anon_send
(
testee
,
seconds
(
1
),
"hello world"
);
self
->
delayed_anon_send
(
testee
,
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
to
(
testee
).
with
(
hello
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
scheduled_anon_send
(
testee
,
self
->
clock
().
now
()
+
seconds
(
1
),
self
->
scheduled_anon_send
(
testee
,
self
->
clock
().
now
()
+
seconds
(
1
),
hello
);
"hello world"
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
to
(
testee
).
with
(
hello
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
delayed_anon_send
(
grp
,
seconds
(
1
),
"hello world"
);
self
->
delayed_anon_send
(
grp
,
seconds
(
1
),
hello
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
to
(
testee
).
with
(
hello
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
self
->
scheduled_anon_send
(
grp
,
self
->
clock
().
now
()
+
seconds
(
1
),
self
->
scheduled_anon_send
(
grp
,
self
->
clock
().
now
()
+
seconds
(
1
),
hello
);
"hello world"
);
sched
.
trigger_timeout
();
sched
.
trigger_timeout
();
expect
((
std
::
string
),
to
(
testee
).
with
(
"hello world"
));
expect
((
std
::
string
),
to
(
testee
).
with
(
hello
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
"hello world"
));
disallow
((
std
::
string
),
from
(
testee
).
to
(
self
).
with
(
hello
));
}
}
CAF_TEST_FIXTURE_SCOPE_END
()
CAF_TEST_FIXTURE_SCOPE_END
()
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