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
c692ab4f
Commit
c692ab4f
authored
Jul 28, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync_send unit test
parent
558b9622
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
unit_testing/test__sync_send.cpp
unit_testing/test__sync_send.cpp
+67
-0
No files found.
unit_testing/test__sync_send.cpp
View file @
c692ab4f
#include "test.hpp"
#include "cppa/cppa.hpp"
using
namespace
cppa
;
/*
test case:
A B C
| | |
| --(sync_send)--> | |
| | --(forward)----> |
| X |---\
| | |
| |<--/
| <-------------(reply)-------------- |
*/
struct
A
:
event_based_actor
{
void
init
()
{
become
(
on
(
atom
(
"go"
),
arg_match
)
>>
[
=
](
const
actor_ptr
&
next
)
{
handle_response
(
sync_send
(
next
,
atom
(
"gogo"
)))
(
on
(
atom
(
"gogogo"
))
>>
[
=
]
{
quit
();
},
after
(
std
::
chrono
::
seconds
(
1
))
>>
[
=
]
{
quit
(
exit_reason
::
user_defined
);
}
);
},
others
()
>>
[
=
]
{
cerr
<<
"UNEXPECTED: "
<<
to_string
(
last_dequeued
())
<<
endl
;
}
);
}
};
struct
B
:
event_based_actor
{
actor_ptr
m_buddy
;
B
(
const
actor_ptr
&
buddy
)
:
m_buddy
(
buddy
)
{
}
void
init
()
{
become
(
others
()
>>
[
=
]()
{
forward_to
(
m_buddy
);
}
);
}
};
struct
C
:
event_based_actor
{
void
init
()
{
become
(
on
(
atom
(
"gogo"
))
>>
[
=
]
{
reply
(
atom
(
"gogogo"
));
}
);
}
};
int
main
()
{
send
(
spawn
<
A
>
(),
atom
(
"go"
),
spawn
<
B
>
(
spawn
<
C
>
()));
await_all_others_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