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
71deb342
Commit
71deb342
authored
Mar 02, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup comments
parent
6b66ed28
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
159 deletions
+55
-159
examples/dynamic_behavior/dining_philosophers.cpp
examples/dynamic_behavior/dining_philosophers.cpp
+27
-28
examples/remoting/distributed_calculator.cpp
examples/remoting/distributed_calculator.cpp
+24
-25
libcaf_core/caf/actor_factory.hpp
libcaf_core/caf/actor_factory.hpp
+0
-5
libcaf_core/caf/detail/mpi_splice.hpp
libcaf_core/caf/detail/mpi_splice.hpp
+0
-24
libcaf_core/caf/input_range.hpp
libcaf_core/caf/input_range.hpp
+1
-3
libcaf_core/caf/replies_to.hpp
libcaf_core/caf/replies_to.hpp
+0
-19
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+0
-21
libcaf_core/test/dynamic_spawn.cpp
libcaf_core/test/dynamic_spawn.cpp
+3
-11
libcaf_core/test/splitter.cpp
libcaf_core/test/splitter.cpp
+0
-23
No files found.
examples/dynamic_behavior/dining_philosophers.cpp
View file @
71deb342
...
...
@@ -64,34 +64,33 @@ chopstick::behavior_type taken_chopstick(chopstick::pointer self,
};
}
/* Based on: http://www.dalnefre.com/wp/2010/08/dining-philosophers-in-humus/
*
*
* +-------------+ {busy|taken}
* /-------->| thinking |<------------------\
* | +-------------+ |
* | | |
* | | {eat} |
* | | |
* | V |
* | +-------------+ {busy} +-------------+
* | | hungry |----------->| denied |
* | +-------------+ +-------------+
* | |
* | | {taken}
* | |
* | V
* | +-------------+
* | | granted |
* | +-------------+
* | | |
* | {busy} | | {taken}
* \-----------/ |
* | V
* | {think} +-------------+
* \---------| eating |
* +-------------+
*/
// Based on: http://www.dalnefre.com/wp/2010/08/dining-philosophers-in-humus/
//
//
// +-------------+ {busy|taken}
// /-------->| thinking |<------------------\
// | +-------------+ |
// | | |
// | | {eat} |
// | | |
// | V |
// | +-------------+ {busy} +-------------+
// | | hungry |----------->| denied |
// | +-------------+ +-------------+
// | |
// | | {taken}
// | |
// | V
// | +-------------+
// | | granted |
// | +-------------+
// | | |
// | {busy} | | {taken}
// \-----------/ |
// | V
// | {think} +-------------+
// \---------| eating |
// +-------------+
class
philosopher
:
public
event_based_actor
{
public:
...
...
examples/remoting/distributed_calculator.cpp
View file @
71deb342
...
...
@@ -48,31 +48,30 @@ behavior calculator_fun() {
};
}
/* State transition of the client for connecting to the server:
*
* +-------------+
* | init |
* +-------------+
* |
* V
* +-------------+
* | unconnected |<------------------\
* +-------------+ |
* | |
* | {connect Host Port} |
* | |
* V |
* +-------------+ {error} |
* /-------------->| connecting |------------------>|
* | +-------------+ ^
* | | |
* | | {ok, Calculator} |
* |{connect Host Port} | |
* | V |
* | +-------------+ {DOWN server} |
* \---------------| running |-------------------/
* +-------------+
*/
// State transition of the client for connecting to the server:
//
// +-------------+
// | init |
// +-------------+
// |
// V
// +-------------+
// | unconnected |<------------------\
// +-------------+ |
// | |
// | {connect Host Port} |
// | |
// V |
// +-------------+ {error} |
// /-------------->| connecting |------------------>|
// | +-------------+ ^
// | | |
// | | {ok, Calculator} |
// |{connect Host Port} | |
// | V |
// | +-------------+ {DOWN server} |
// \---------------| running |-------------------/
// +-------------+
namespace
client
{
...
...
libcaf_core/caf/actor_factory.hpp
View file @
71deb342
...
...
@@ -192,11 +192,6 @@ actor_factory_result dyn_spawn_class(actor_config& cfg, message& msg) {
template
<
class
T
,
class
...
Ts
>
actor_factory
make_actor_factory
()
{
/*
static_assert(std::is_same<T*, decltype(new T(std::declval<actor_config&>(),
std::declval<Ts>()...))>::value,
"no constructor for T(Ts...) exists");
*/
static_assert
(
detail
::
conjunction
<
std
::
is_lvalue_reference
<
Ts
>::
value
...
>::
value
,
...
...
libcaf_core/caf/detail/mpi_splice.hpp
View file @
71deb342
...
...
@@ -29,30 +29,6 @@
namespace
caf
{
namespace
detail
{
/*
template <class Input, class X, class... Ts>
struct mpi_splice_one;
template <class Input, class X>
struct mpi_splice_one<Input, X> {
using type = X;
};
template <class Input, class X, class... Ts>
struct mpi_splice_one<Input, X, none_t, Ts...> {
using type = none_t;
};
template <class Input, class... Ys, class... Zs, class... Ts>
struct mpi_splice_one<Input,
typed_mpi<Input, type_list<Ys...>>,
typed_mpi<Input, type_list<Zs...>>,
Ts...>
: mpi_splice_one<typed_mpi<type_list<Xs...>, type_list<Ys..., Zs...>>, Ts...> {
// combine signatures with same input
};
*/
template
<
class
T
,
class
...
Lists
>
struct
mpi_splice_by_input
;
...
...
libcaf_core/caf/input_range.hpp
View file @
71deb342
...
...
@@ -113,9 +113,7 @@ private:
I
last_
;
};
/**
* @relates input_range
*/
/// @relates input_range
template
<
class
I
>
input_range_impl
<
I
>
make_input_range
(
I
first
,
I
last
)
{
return
{
first
,
last
};
...
...
libcaf_core/caf/replies_to.hpp
View file @
71deb342
...
...
@@ -43,25 +43,6 @@ struct output_tuple {};
template
<
class
Input
,
class
Output
>
struct
typed_mpi
{};
/*
<detail::type_list<Is...>,
detail::type_list<Ls...>> {
static_assert(sizeof...(Is) > 0, "template parameter pack Is empty");
static_assert(sizeof...(Ls) > 0, "template parameter pack Ls empty");
using input = detail::type_list<Is...>;
using output = detail::type_list<Ls...>;
static_assert(!detail::tl_exists<
input_types,
is_illegal_message_element
>::value
&& !detail::tl_exists<
output_types,
is_illegal_message_element
>::value,
"interface definition contains an illegal message type");
};
*/
template
<
class
...
Is
>
struct
replies_to
{
template
<
class
...
Os
>
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
71deb342
...
...
@@ -402,13 +402,6 @@ void scheduled_actor::quit(error x) {
// -- stream management --------------------------------------------------------
/*
void scheduled_actor::trigger_downstreams() {
for (auto& s : streams_)
s.second->push();
}
*/
sec
scheduled_actor
::
build_pipeline
(
stream_slot
in
,
stream_slot
out
,
stream_manager_ptr
mgr
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
in
)
<<
CAF_ARG
(
out
)
<<
CAF_ARG
(
mgr
));
...
...
@@ -592,22 +585,8 @@ invoke_message_result scheduled_actor::consume(mailbox_element& x) {
auto
ordinary_invoke
=
[](
ptr_t
,
behavior
&
f
,
mailbox_element
&
in
)
->
bool
{
return
f
(
in
.
content
())
!=
none
;
};
/*
auto stream_invoke = [](ptr_t, behavior&, mailbox_element&) -> bool {
// The only legal stream message in a response is `stream_open`.
auto& var = in.content().get_as<stream_msg>(0).content;
if (holds_alternative<stream_msg::open>(var))
return p->handle_stream_msg(in, &f);
return false;
};
*/
auto
select_invoke_fun
=
[
&
]()
->
fun_t
{
return
ordinary_invoke
;
/*
if (x.content().type_token() != make_type_token<stream_msg>())
return ordinary_invoke;
return stream_invoke;
*/
};
// Short-circuit awaited responses.
if
(
!
awaited_responses_
.
empty
())
{
...
...
libcaf_core/test/dynamic_spawn.cpp
View file @
71deb342
...
...
@@ -332,7 +332,9 @@ CAF_TEST(self_receive_with_zero_timeout) {
[
&
]
{
CAF_ERROR
(
"Unexpected message"
);
},
after
(
chrono
::
seconds
(
0
))
>>
[]
{
/* mailbox empty */
}
after
(
chrono
::
seconds
(
0
))
>>
[]
{
// mailbox empty
}
);
}
...
...
@@ -551,16 +553,6 @@ CAF_TEST(move_only_argument) {
};
auto
f
=
make_function_view
(
system
.
spawn
(
impl
,
std
::
move
(
uptr
)));
CAF_CHECK_EQUAL
(
to_string
(
f
(
1.
f
)),
"(42)"
);
/*
auto testee = system.spawn(f, std::move(uptr));
scoped_actor self{system};
self->request(testee, infinite, 1.f).receive(
[](int i) {
CAF_CHECK_EQUAL(i, 42);
},
ERROR_HANDLER
);
*/
}
CAF_TEST_FIXTURE_SCOPE_END
()
libcaf_core/test/splitter.cpp
View file @
71deb342
...
...
@@ -114,27 +114,4 @@ CAF_TEST(untyped_splicing) {
);
}
/*
CAF_TEST(typed_splicing) {
using namespace std::placeholders;
auto stage0 = system.spawn(typed_first_stage);
auto stage2 = system.spawn(typed_second_stage);
auto stages = splice(stage0, stage2);
using expected_type = typed_actor<replies_to<double>
::with<double, double, double>>;
static_assert(std::is_same<decltype(stages), expected_type>::value,
"splice() did not compute the correct result");
self->request(stages, infinite, 42.0).receive(
[](double x, double y, double z) {
CAF_CHECK_EQUAL(x, (42.0 * 2.0));
CAF_CHECK_EQUAL(y, (42.0 * 4.0));
CAF_CHECK_EQUAL(z, (23.0 * 42.0));
},
ERROR_HANDLER
);
// stage0 and stage2 go out of scope, leaving only the references
// in stages, which will also go out of scope
}
*/
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