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
0c3537cb
Commit
0c3537cb
authored
Apr 30, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distributed benchmark
parent
51cc731e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
423 additions
and
256 deletions
+423
-256
benchmarks/distributed.cpp
benchmarks/distributed.cpp
+71
-3
benchmarks/distributed.erl
benchmarks/distributed.erl
+93
-0
cppa.files
cppa.files
+242
-241
src/cppa.cpp
src/cppa.cpp
+17
-12
No files found.
benchmarks/distributed.cpp
View file @
0c3537cb
...
@@ -86,7 +86,13 @@ void usage()
...
@@ -86,7 +86,13 @@ void usage()
<<
" of given servers, use HOST:PORT syntax"
<<
endl
<<
" of given servers, use HOST:PORT syntax"
<<
endl
<<
" --num_pings=NUM run benchmark with NUM messages per node"
<<
endl
<<
" --num_pings=NUM run benchmark with NUM messages per node"
<<
endl
<<
endl
<<
endl
<<
" example: --mode=benchmark 192.168.9.1:123 --num_pings=100"
<<
endl
<<
" example: --mode=benchmark 192.168.9.1:1234 "
"192.168.9.2:1234 "
"--num_pings=100"
<<
endl
<<
endl
<<
endl
<<
"Shutdown servers:"
<<
endl
<<
" --mode=shutdown shuts down any number of given servers"
<<
endl
<<
endl
<<
endl
<<
endl
<<
endl
<<
"Miscellaneous:"
<<
endl
<<
"Miscellaneous:"
<<
endl
...
@@ -224,6 +230,11 @@ struct server_actor : fsm_actor<server_actor>
...
@@ -224,6 +230,11 @@ struct server_actor : fsm_actor<server_actor>
});
});
if
(
i
!=
m_pongs
.
end
())
m_pongs
.
erase
(
i
);
if
(
i
!=
m_pongs
.
end
())
m_pongs
.
erase
(
i
);
},
},
on
(
atom
(
"shutdown"
))
>>
[
=
]()
{
m_pongs
.
clear
();
become_void
();
},
others
()
>>
[
=
]()
others
()
>>
[
=
]()
{
{
cout
<<
"unexpected: "
<<
to_string
(
last_dequeued
())
<<
endl
;
cout
<<
"unexpected: "
<<
to_string
(
last_dequeued
())
<<
endl
;
...
@@ -324,6 +335,11 @@ void client_mode(Iterator first, Iterator last)
...
@@ -324,6 +335,11 @@ void client_mode(Iterator first, Iterator last)
cout
<<
"no non-zero, non-negative init value given"
<<
endl
;
cout
<<
"no non-zero, non-negative init value given"
<<
endl
;
exit
(
1
);
exit
(
1
);
}
}
if
(
remotes
.
size
()
<
2
)
{
cout
<<
"less than two nodes given"
<<
endl
;
exit
(
1
);
}
std
::
vector
<
actor_ptr
>
remote_actors
;
std
::
vector
<
actor_ptr
>
remote_actors
;
for
(
auto
&
r
:
remotes
)
for
(
auto
&
r
:
remotes
)
{
{
...
@@ -398,6 +414,48 @@ void client_mode(Iterator first, Iterator last)
...
@@ -398,6 +414,48 @@ void client_mode(Iterator first, Iterator last)
await_all_others_done
();
await_all_others_done
();
}
}
template
<
typename
Iterator
>
void
shutdown_mode
(
Iterator
first
,
Iterator
last
)
{
std
::
vector
<
std
::
pair
<
string
,
uint16_t
>
>
remotes
;
match_each
(
first
,
last
,
std
::
bind
(
split
,
std
::
placeholders
::
_1
,
':'
))
(
on
(
val
<
string
>
,
_2i
)
>>
[
&
](
string
&
host
,
int
port
)
{
if
(
port
<=
1024
||
port
>=
65536
)
{
throw
std
::
invalid_argument
(
"illegal port: "
+
std
::
to_string
(
port
));
}
remotes
.
emplace_back
(
std
::
move
(
host
),
static_cast
<
uint16_t
>
(
port
));
}
);
for
(
auto
&
r
:
remotes
)
{
try
{
actor_ptr
x
=
remote_actor
(
r
.
first
.
c_str
(),
r
.
second
);
monitor
(
x
);
send
(
x
,
atom
(
"shutdown"
));
receive
(
on
(
atom
(
"DOWN"
),
x
,
val
<
std
::
uint32_t
>
)
>>
[]()
{
// ok, done
},
after
(
std
::
chrono
::
seconds
(
10
))
>>
[
&
]()
{
cout
<<
r
.
first
<<
":"
<<
r
.
second
<<
" didn't shut down "
<<
"within 10s"
<<
endl
;
}
);
}
catch
(...)
{
}
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
if
(
argc
<
2
)
usage
();
if
(
argc
<
2
)
usage
();
...
@@ -405,13 +463,23 @@ int main(int argc, char** argv)
...
@@ -405,13 +463,23 @@ int main(int argc, char** argv)
auto
last
=
argv
+
argc
;
auto
last
=
argv
+
argc
;
match
(
*
first
)
match
(
*
first
)
(
(
on
<
string
>
().
when
(
_x1
.
in
({
"-h"
,
"--help"
}))
>>
[]()
{
usage
();
},
on
<
string
>
().
when
(
_x1
.
in
({
"-h"
,
"--help"
}))
>>
[]()
on
(
"--mode=server"
)
>>
[
=
]()
{
server_mode
(
first
+
1
,
last
);
},
{
usage
();
},
on
(
"--mode=server"
)
>>
[
=
]()
{
server_mode
(
first
+
1
,
last
);
},
on
(
"--mode=benchmark"
)
>>
[
=
]()
on
(
"--mode=benchmark"
)
>>
[
=
]()
{
{
client_mode
(
first
+
1
,
last
);
client_mode
(
first
+
1
,
last
);
await_all_others_done
();
await_all_others_done
();
},
},
on
(
"--mode=shutdown"
)
>>
[
=
]()
{
shutdown_mode
(
first
+
1
,
last
);
},
others
()
>>
[
=
]()
others
()
>>
[
=
]()
{
{
usage
(
"unknown argument: "
,
*
first
);
usage
(
"unknown argument: "
,
*
first
);
...
...
benchmarks/distributed.erl
0 → 100644
View file @
0c3537cb
-
module
(
distributed
).
-
export
([
start
/
1
,
ping_loop
/
2
]).
ping_loop
(
Parent
,
Pong
)
->
receive
{
pong
,
0
}
->
Parent
!
done
;
{
pong
,
X
}
->
Pong
!
{
self
(),
ping
,
X
-
1
},
ping_loop
(
Parent
,
Pong
);
{
kickoff
,
Value
}
->
Pong
!
{
ping
,
self
(),
Value
},
ping_loop
(
Parent
,
Pong
)
end
.
server_loop
(
Pongs
)
->
receive
{
ping
,
Pid
,
Value
}
->
Pid
!
{
pong
,
Value
};
{
add_pong
,
Pid
,
Node
}
->
case
lists
:
any
(
fun
({
N
,
_})
->
N
==
Node
end
,
Pongs
)
of
true
->
Pid
!
{
ok
},
server_loop
(
Pongs
);
false
->
case
rpc
:
call
(
Node
,
erlang
,
whereis
,
[
pong
])
of
{
badrpc
,
Reason
}
->
Pid
!
{
error
,
Reason
};
Pong
->
Pid
!
{
ok
},
server_loop
(
Pongs
++
[{
Node
,
Pong
}])
end
end
;
{
purge
}
->
server_loop
([]);
{
kickoff
,
Pid
,
NumPings
}
->
lists
:
foreach
(
fun
({_,
P
})
->
spawn
(
distributed
,
ping_loop
,
[
Pid
,
P
])
!
{
kickoff
,
NumPings
}
end
,
Pongs
),
server_loop
(
Pongs
)
end
.
server_mode
()
->
register
(
pong
,
self
()),
server_loop
([]).
add_pong_fun
(_,
_,
[])
->
true
;
add_pong_fun
(
Pong
,
Node
,
[
Node
|
T
])
->
add_pong_fun
(
Pong
,
Node
,
T
);
add_pong_fun
(
Pong
,
Node
,
[
H
|
T
])
->
Pong
!
{
add_pong
,
H
},
receive
{
ok
}
->
add_pong_fun
(
Pong
,
Node
,
T
);
{
error
,
Reason
}
->
error
(
Reason
)
end
.
% receive a {done} message for each node
client_mode
([],
[],
[],
_)
->
true
;
client_mode
([],
[],
[_|
T
],
NumPings
)
->
receive
{
done
}
->
client_mode
([],
[],
T
,
NumPings
)
end
;
% send kickoff messages
client_mode
([
Pong
|
Pongs
],
[],
Nodes
,
NumPings
)
->
Pong
!
{
kickoff
,
self
(),
NumPings
},
client_mode
(
Pongs
,
[],
Nodes
,
NumPings
);
client_mode
(
Pongs
,
[
H
|
T
],
Nodes
,
NumPings
)
->
case
rpc
:
call
(
H
,
erlang
,
whereis
,
[
pong
])
of
{
badrpc
,
Reason
}
->
io
:
format
(
"cannot connect to
~s~n
"
,
[
atom_to_list
(
H
)]),
error
(
Reason
);
P
->
add_pong_fun
(
P
,
H
,
Nodes
),
client_mode
(
Pongs
++
[
P
],
T
,
Nodes
,
NumPings
)
end
.
run
([],
undefined
,
[
'mode=server'
])
->
server_mode
();
run
(_,
undefined
,
[])
->
error
(
"NumPings is undefined"
);
run
(
Hosts
,
_,
[])
when
length
(
Hosts
)
<
2
->
error
(
"less than two nodes specified"
);
run
(
Hosts
,
NumPings
,
[])
->
client_mode
([],
Hosts
,
Hosts
,
NumPings
);
run
(
Hosts
,
NumPings
,
[
H
|
T
])
->
Arg
=
atom_to_list
(
H
),
SetNumPings
=
lists
:
prefix
(
"num_pings="
,
Arg
),
if
SetNumPings
==
true
andalso
NumPings
/=
undefined
->
error
(
"NumPings already set"
);
SetNumPings
==
true
->
run
(
Hosts
,
list_to_integer
(
lists
:
sublist
(
Arg
,
11
,
length
(
Arg
))),
T
);
true
->
run
(
Hosts
++
[
H
],
NumPings
,
T
)
end
.
start
(
X
)
->
run
([],
undefined
,
X
).
cppa.files
View file @
0c3537cb
cppa/ref_counted.hpp
benchmarks/ActorCreation.scala
cppa/cow_tuple.hpp
benchmarks/MailboxPerformance.scala
unit_testing/main.cpp
benchmarks/Matching.scala
cppa/util/void_type.hpp
benchmarks/MixedCase.scala
cppa/util/type_list.hpp
benchmarks/PingPong.scala
cppa/util/conjunction.hpp
benchmarks/actor_creation.cpp
cppa/util/disjunction.hpp
benchmarks/actor_creation.erl
unit_testing/test.hpp
benchmarks/distributed.cpp
cppa/uniform_type_info.hpp
benchmarks/distributed.erl
src/uniform_type_info.cpp
benchmarks/mailbox_performance.cpp
benchmarks/mailbox_performance.erl
benchmarks/matching.cpp
benchmarks/matching.erl
benchmarks/mixed_case.cpp
benchmarks/mixed_case.erl
benchmarks/theron_actor_creation.cpp
benchmarks/theron_mailbox_performance.cpp
benchmarks/theron_mixed_case.cpp
benchmarks/utility.hpp
cppa/abstract_actor.hpp
cppa/abstract_event_based_actor.hpp
cppa/actor.hpp
cppa/actor_proxy.hpp
cppa/announce.hpp
cppa/any_tuple.hpp
cppa/anything.hpp
cppa/atom.hpp
cppa/attachable.hpp
cppa/behavior.hpp
cppa/binary_deserializer.hpp
cppa/binary_serializer.hpp
cppa/channel.hpp
cppa/config.hpp
cppa/config.hpp
unit_testing/test__tuple.cpp
cppa/cow_ptr.hpp
cppa/cow_tuple.hpp
cppa/cppa.hpp
cppa/deserializer.hpp
cppa/detail/abstract_scheduled_actor.hpp
cppa/detail/abstract_tuple.hpp
cppa/detail/abstract_tuple.hpp
cppa/detail/tuple_vals.hpp
cppa/detail/actor_count.hpp
cppa/detail/actor_proxy_cache.hpp
cppa/detail/actor_registry.hpp
cppa/detail/addressed_message.hpp
cppa/detail/atom_val.hpp
cppa/detail/boxed.hpp
cppa/detail/buffer.hpp
cppa/detail/channel.hpp
cppa/detail/container_tuple_view.hpp
cppa/detail/converted_thread_context.hpp
cppa/detail/decorated_tuple.hpp
cppa/detail/decorated_tuple.hpp
cppa/cow_ptr.hpp
cppa/detail/default_uniform_type_info_impl.hpp
cppa/detail/ref_counted_impl.hpp
cppa/detail/demangle.hpp
cppa/intrusive_ptr.hpp
cppa/detail/disablable_delete.hpp
unit_testing/test__spawn.cpp
cppa/detail/empty_tuple.hpp
src/mock_scheduler.cpp
cppa/detail/filter_result.hpp
cppa/actor.hpp
cppa/detail/get_behavior.hpp
unit_testing/test__intrusive_ptr.cpp
cppa/detail/group_manager.hpp
cppa/util/callable_trait.hpp
cppa/detail/implicit_conversions.hpp
unit_testing/test__type_list.cpp
cppa/util/compare_tuples.hpp
cppa/get.hpp
cppa/detail/tdata.hpp
cppa/detail/invokable.hpp
cppa/detail/invokable.hpp
cppa/on.hpp
cppa/detail/list_member.hpp
unit_testing/test__serialization.cpp
cppa/detail/mailman.hpp
cppa/serializer.hpp
cppa/detail/map_member.hpp
cppa/deserializer.hpp
cppa/detail/matches.hpp
cppa/object.hpp
cppa/detail/mock_scheduler.hpp
cppa/detail/native_socket.hpp
cppa/detail/nestable_receive_actor.hpp
cppa/detail/network_manager.hpp
cppa/detail/object_array.hpp
cppa/detail/object_impl.hpp
cppa/detail/object_impl.hpp
cppa/detail/swap_bytes.hpp
cppa/detail/pair_member.hpp
src/serializer.cpp
cppa/detail/post_office.hpp
src/deserializer.cpp
cppa/detail/primitive_member.hpp
cppa/util/is_legal_tuple_type.hpp
cppa/detail/projection.hpp
cppa/util/replace_type.hpp
cppa/detail/pseudo_tuple.hpp
cppa/detail/ptype_to_type.hpp
cppa/detail/receive_loop_helper.hpp
cppa/detail/recursive_queue_node.hpp
cppa/detail/ref_counted_impl.hpp
cppa/detail/scheduled_actor_dummy.hpp
cppa/detail/serialize_tuple.hpp
cppa/detail/serialize_tuple.hpp
unit_testing/test__atom.cpp
cppa/detail/singleton_manager.hpp
cppa/detail/swap_bytes.hpp
cppa/detail/tdata.hpp
cppa/detail/thread.hpp
cppa/detail/thread_pool_scheduler.hpp
cppa/detail/to_uniform_name.hpp
cppa/detail/tuple_cast_impl.hpp
cppa/detail/tuple_iterator.hpp
cppa/detail/tuple_vals.hpp
cppa/detail/tuple_view.hpp
cppa/detail/type_to_ptype.hpp
cppa/detail/types_array.hpp
cppa/detail/unboxed.hpp
cppa/detail/uniform_type_info_map.hpp
cppa/detail/value_guard.hpp
cppa/detail/yield_interface.hpp
cppa/detail/yielding_actor.hpp
cppa/either.hpp
cppa/event_based_actor.hpp
cppa/event_based_actor_base.hpp
cppa/exception.hpp
cppa/exit_reason.hpp
cppa/from_string.hpp
cppa/fsm_actor.hpp
cppa/get.hpp
cppa/group.hpp
cppa/guard_expr.hpp
cppa/intrusive/forward_iterator.hpp
cppa/intrusive/single_reader_queue.hpp
cppa/intrusive/single_reader_queue.hpp
unit_testing/test__local_group.c
pp
cppa/intrusive/singly_linked_list.h
pp
cppa/
detail/channel
.hpp
cppa/
intrusive_ptr
.hpp
cppa/local_actor.hpp
cppa/local_actor.hpp
cppa/channel.hpp
cppa/match.hpp
src/channel.cpp
cppa/match_expr.hpp
cppa/object.hpp
cppa/on.hpp
cppa/option.hpp
cppa/partial_function.hpp
cppa/pattern.hpp
cppa/primitive_type.hpp
cppa/primitive_variant.hpp
cppa/process_information.hpp
cppa/receive.hpp
cppa/ref_counted.hpp
cppa/scheduled_actor.hpp
cppa/scheduled_actor.hpp
cppa/cppa.hpp
cppa/scheduling_hint.hpp
src/scheduled_actor.cpp
cppa/group.hpp
src/group.cpp
queue_performances/main.cpp
queue_performances/sutter_list.hpp
queue_performances/defines.hpp
queue_performances/cached_stack.hpp
queue_performances/blocking_cached_stack.hpp
queue_performances/blocking_cached_stack2.hpp
queue_performances/blocking_sutter_list.hpp
queue_performances/lockfree_list.hpp
queue_performances/intrusive_sutter_list.hpp
src/local_actor.cpp
cppa/scheduler.hpp
cppa/scheduler.hpp
cppa/detail/mock_scheduler.hpp
cppa/scheduling_hint.hpp
src/scheduler.cpp
cppa/self.hpp
cppa/detail/converted_thread_context.hpp
cppa/serializer.hpp
src/converted_thread_context.cpp
cppa/stacked_event_based_actor.hpp
unit_testing/test__uniform_type.cpp
cppa/detail/demangle.hpp
src/demangle.cpp
cppa/detail/to_uniform_name.hpp
src/to_uniform_name.cpp
cppa/detail/default_uniform_type_info_impl.hpp
src/object.cpp
cppa/util/comparable.hpp
cppa/primitive_variant.hpp
cppa/primitive_type.hpp
cppa/util/pt_token.hpp
cppa/detail/type_to_ptype.hpp
cppa/detail/ptype_to_type.hpp
cppa/util/is_primitive.hpp
cppa/util/is_iterable.hpp
src/primitive_variant.cpp
unit_testing/test__primitive_variant.cpp
cppa/detail/primitive_member.hpp
cppa/detail/list_member.hpp
cppa/detail/pair_member.hpp
cppa/detail/map_member.hpp
cppa/util/is_forward_iterator.hpp
cppa/util/rm_ref.hpp
cppa/binary_serializer.hpp
src/binary_serializer.cpp
cppa/binary_deserializer.hpp
src/binary_deserializer.cpp
src/actor.cpp
cppa/announce.hpp
cppa/util/shared_spinlock.hpp
src/shared_spinlock.cpp
cppa/util/shared_lock_guard.hpp
cppa/detail/object_array.hpp
src/object_array.cpp
cppa/any_tuple.hpp
src/any_tuple.cpp
cppa/util/abstract_uniform_type_info.hpp
cppa/util/upgrade_lock_guard.hpp
cppa/to_string.hpp
cppa/to_string.hpp
src/string_serialization.cpp
cppa/tpartial_function.hpp
cppa/from_string.hpp
cppa/tuple_cast.hpp
cppa/type_value_pair.hpp
cppa/uniform_type_info.hpp
cppa/util/abstract_uniform_type_info.hpp
cppa/util/apply_args.hpp
cppa/util/apply_tuple.hpp
cppa/util/arg_match_t.hpp
cppa/util/at.hpp
cppa/util/at.hpp
cppa/util/callable_trait.hpp
cppa/util/comparable.hpp
cppa/util/compare_tuples.hpp
cppa/util/conjunction.hpp
cppa/util/deduce_ref_type.hpp
cppa/util/disjunction.hpp
cppa/util/duration.hpp
cppa/util/element_at.hpp
cppa/util/element_at.hpp
cppa/util/fiber.hpp
cppa/util/fixed_vector.hpp
cppa/util/if_else.hpp
cppa/util/if_else.hpp
cppa/util/is_array_of.hpp
cppa/util/is_builtin.hpp
cppa/util/is_comparable.hpp
cppa/util/is_forward_iterator.hpp
cppa/util/is_iterable.hpp
cppa/util/is_legal_tuple_type.hpp
cppa/util/is_manipulator.hpp
cppa/util/is_mutable_ref.hpp
cppa/util/is_primitive.hpp
cppa/util/left_or_right.hpp
cppa/util/producer_consumer_list.hpp
cppa/util/projection.hpp
cppa/util/pt_dispatch.hpp
cppa/util/pt_dispatch.hpp
cppa/detail/get_behavior.hpp
cppa/util/pt_token.hpp
unit_testing/test__ripemd_160.cpp
cppa/util/purge_refs.hpp
cppa/process_information.hpp
cppa/util/replace_type.hpp
src/process_information.cpp
cppa/util/ripemd_160.hpp
cppa/util/ripemd_160.hpp
src/ripemd_160.cpp
cppa/util/rm_option.hpp
src/unicast_network.cpp
cppa/util/rm_ref.hpp
unit_testing/test__remote_actor.cpp
cppa/util/shared_lock_guard.hpp
unit_testing/ping_pong.hpp
cppa/util/shared_spinlock.hpp
unit_testing/ping_pong.cpp
cppa/util/static_foreach.hpp
cppa/exception.hpp
cppa/util/tbind.hpp
src/exception.cpp
cppa/util/type_list.hpp
cppa/actor_proxy.hpp
cppa/util/type_pair.hpp
src/actor_proxy.cpp
cppa/util/upgrade_lock_guard.hpp
cppa/detail/actor_proxy_cache.hpp
cppa/util/void_type.hpp
src/actor_proxy_cache.cpp
src/attachable.cpp
cppa/attachable.hpp
cppa/atom.hpp
cppa/detail/atom_val.hpp
src/atom.cpp
src/cppa.cpp
cppa/exit_reason.hpp
cppa/abstract_actor.hpp
cppa/detail/mailman.hpp
src/mailman.cpp
cppa/detail/native_socket.hpp
src/native_socket.cpp
cppa/detail/post_office.hpp
src/post_office.cpp
cppa/detail/buffer.hpp
cppa/detail/actor_count.hpp
src/actor_count.cpp
cppa/util/fiber.hpp
src/fiber.cpp
cppa/detail/yield_interface.hpp
src/yield_interface.cpp
cppa/detail/abstract_scheduled_actor.hpp
src/scheduled_actor_dummy.cpp
src/invokable.cpp
cppa/detail/thread_pool_scheduler.hpp
src/thread_pool_scheduler.cpp
cppa/detail/receive_loop_helper.hpp
cppa/util/wrapped.hpp
cppa/util/wrapped.hpp
cppa/detail/boxed.hpp
cppa/detail/unboxed.hpp
src/abstract_tuple.cpp
cppa/util/duration.hpp
src/duration.cpp
cppa/receive.hpp
cppa/detail/thread.hpp
cppa/detail/singleton_manager.hpp
src/singleton_manager.cpp
cppa/detail/actor_registry.hpp
src/actor_registry.cpp
cppa/detail/uniform_type_info_map.hpp
cppa/detail/network_manager.hpp
src/network_manager.cpp
cppa/detail/group_manager.hpp
src/group_manager.cpp
cppa/detail/empty_tuple.hpp
src/empty_tuple.cpp
cppa/detail/addressed_message.hpp
src/addressed_message.cpp
unit_testing/test__yield_interface.cpp
cppa/anything.hpp
cppa/pattern.hpp
unit_testing/test__pattern.cpp
cppa/util/fixed_vector.hpp
cppa/detail/implicit_conversions.hpp
cppa/util/is_array_of.hpp
examples/announce_example_1.cpp
examples/announce_example_1.cpp
examples/announce_example_2.cpp
examples/announce_example_2.cpp
examples/announce_example_3.cpp
examples/announce_example_3.cpp
examples/announce_example_4.cpp
examples/announce_example_4.cpp
examples/announce_example_5.cpp
examples/announce_example_5.cpp
examples/dancing_kirby.cpp
examples/dining_philosophers.cpp
examples/hello_world_example.cpp
examples/hello_world_example.cpp
examples/math_actor_example.cpp
examples/math_actor_example.cpp
cppa/detail/yielding_actor.hpp
queue_performances/blocking_cached_stack.hpp
src/yielding_actor.cpp
queue_performances/blocking_cached_stack2.hpp
cppa/either.hpp
queue_performances/blocking_sutter_list.hpp
cppa/abstract_event_based_actor.hpp
queue_performances/cached_stack.hpp
queue_performances/defines.hpp
queue_performances/intrusive_sutter_list.hpp
queue_performances/lockfree_list.hpp
queue_performances/main.cpp
queue_performances/sutter_list.hpp
src/abstract_event_based_actor.cpp
src/abstract_event_based_actor.cpp
cppa/event_based_actor.hpp
src/abstract_tuple.cpp
src/actor.cpp
src/actor_count.cpp
src/actor_proxy.cpp
src/actor_proxy_cache.cpp
src/actor_registry.cpp
src/addressed_message.cpp
src/any_tuple.cpp
src/atom.cpp
src/attachable.cpp
src/binary_deserializer.cpp
src/binary_serializer.cpp
src/channel.cpp
src/converted_thread_context.cpp
src/cppa.cpp
src/demangle.cpp
src/deserializer.cpp
src/duration.cpp
src/empty_tuple.cpp
src/event_based_actor.cpp
src/event_based_actor.cpp
cppa/stacked_event_based_actor.hpp
src/exception.cpp
src/stacked_event_based_actor.cpp
src/fiber.cpp
cppa/event_based_actor_base.hpp
src/group.cpp
cppa/fsm_actor.hpp
src/group_manager.cpp
cppa/self.hpp
src/invokable.cpp
src/self.cpp
src/local_actor.cpp
cppa/behavior.hpp
src/mailman.cpp
src/mock_scheduler.cpp
src/native_socket.cpp
src/network_manager.cpp
src/object.cpp
src/object_array.cpp
src/partial_function.cpp
src/pattern.cpp
src/post_office.cpp
src/primitive_variant.cpp
src/process_information.cpp
src/receive.cpp
src/receive.cpp
benchmarks/actor_creation.cpp
src/ripemd_160.cpp
benchmarks/mailbox_performance.cpp
src/scheduled_actor.cpp
benchmarks/mixed_case.cpp
src/scheduled_actor_dummy.cpp
benchmarks/actor_creation.erl
src/scheduler.cpp
benchmarks/mailbox_performance.erl
src/self.cpp
benchmarks/mixed_case.erl
src/serializer.cpp
benchmarks/ActorCreation.scala
src/shared_spinlock.cpp
benchmarks/MailboxPerformance.scala
src/singleton_manager.cpp
benchmarks/MixedCase.scala
src/stacked_event_based_actor.cpp
cppa/util/producer_consumer_list.hpp
src/string_serialization.cpp
cppa/util/arg_match_t.hpp
src/thread_pool_scheduler.cpp
cppa/detail/types_array.hpp
src/to_uniform_name.cpp
cppa/util/is_builtin.hpp
src/unicast_network.cpp
cppa/util/type_pair.hpp
src/uniform_type_info.cpp
cppa/util/tbind.hpp
src/yield_interface.cpp
cppa/option.hpp
src/yielding_actor.cpp
cppa/tuple_cast.hpp
unit_testing/main.cpp
cppa/util/is_mutable_ref.hpp
unit_testing/ping_pong.cpp
cppa/util/is_manipulator.hpp
unit_testing/ping_pong.hpp
cppa/util/apply_tuple.hpp
unit_testing/test.hpp
benchmarks/Matching.scala
unit_testing/test__atom.cpp
benchmarks/matching.cpp
benchmarks/matching.erl
benchmarks/theron_mailbox_performance.cpp
benchmarks/utility.hpp
benchmarks/theron_actor_creation.cpp
benchmarks/theron_mixed_case.cpp
cppa/util/static_foreach.hpp
cppa/type_value_pair.hpp
examples/dining_philosophers.cpp
cppa/detail/disablable_delete.hpp
unit_testing/test__fixed_vector.cpp
unit_testing/test__fixed_vector.cpp
cppa/detail/tuple_cast_impl.hpp
cppa/match.hpp
cppa/partial_function.hpp
src/partial_function.cpp
cppa/intrusive/singly_linked_list.hpp
cppa/intrusive/forward_iterator.hpp
unit_testing/test__intrusive_containers.cpp
unit_testing/test__intrusive_containers.cpp
examples/dancing_kirby.cpp
unit_testing/test__intrusive_ptr.cpp
cppa/util/is_comparable.hpp
unit_testing/test__local_group.cpp
cppa/detail/tuple_view.hpp
cppa/detail/container_tuple_view.hpp
cppa/detail/matches.hpp
unit_testing/test__match.cpp
unit_testing/test__match.cpp
cppa/guard_expr.hpp
unit_testing/test__pattern.cpp
src/pattern.cpp
unit_testing/test__primitive_variant.cpp
cppa/util/left_or_right.hpp
unit_testing/test__remote_actor.cpp
cppa/util/apply_args.hpp
unit_testing/test__ripemd_160.cpp
cppa/tpartial_function.hpp
unit_testing/test__serialization.cpp
cppa/util/rm_option.hpp
unit_testing/test__spawn.cpp
cppa/util/projection.hpp
unit_testing/test__tuple.cpp
cppa/util/purge_refs.hpp
unit_testing/test__type_list.cpp
cppa/util/deduce_ref_type.hpp
unit_testing/test__uniform_type.cpp
cppa/detail/projection.hpp
unit_testing/test__yield_interface.cpp
cppa/detail/value_guard.hpp
cppa/detail/tuple_iterator.hpp
cppa/match_expr.hpp
cppa/detail/pseudo_tuple.hpp
cppa/detail/recursive_queue_node.hpp
cppa/detail/scheduled_actor_dummy.hpp
cppa/detail/nestable_receive_actor.hpp
cppa/detail/filter_result.hpp
benchmarks/PingPong.scala
benchmarks/distributed.cpp
src/cppa.cpp
View file @
0c3537cb
...
@@ -31,29 +31,36 @@
...
@@ -31,29 +31,36 @@
#include "cppa/cppa.hpp"
#include "cppa/cppa.hpp"
#include "cppa/local_actor.hpp"
#include "cppa/local_actor.hpp"
namespace
cppa
{
namespace
{
namespace
{
class
observer
:
public
cppa
::
attachable
class
down_observer
:
public
attachable
{
{
cppa
::
actor_ptr
m_client
;
actor_ptr
m_observer
;
actor_ptr
m_observed
;
public:
public:
observer
(
cppa
::
actor_ptr
&&
client
)
:
m_client
(
std
::
move
(
client
))
{
}
down_observer
(
actor_ptr
observer
,
actor_ptr
observed
)
:
m_observer
(
std
::
move
(
observer
))
,
m_observed
(
std
::
move
(
observed
))
{
}
void
actor_exited
(
std
::
uint32_t
reason
)
void
actor_exited
(
std
::
uint32_t
reason
)
{
{
using
namespace
cppa
;
using
namespace
cppa
;
send
(
m_
client
,
atom
(
"DOWN"
),
actor_ptr
(
self
)
,
reason
);
send
(
m_
observer
,
atom
(
"DOWN"
),
m_observed
,
reason
);
}
}
bool
matches
(
const
cppa
::
attachable
::
token
&
match_token
)
bool
matches
(
const
attachable
::
token
&
match_token
)
{
{
if
(
match_token
.
subtype
==
typeid
(
observer
))
if
(
match_token
.
subtype
==
typeid
(
down_
observer
))
{
{
auto
ptr
=
reinterpret_cast
<
const
cppa
::
local_actor
*>
(
match_token
.
ptr
);
auto
ptr
=
reinterpret_cast
<
const
local_actor
*>
(
match_token
.
ptr
);
return
m_
client
==
ptr
;
return
m_
observer
==
ptr
;
}
}
return
false
;
return
false
;
}
}
...
@@ -62,8 +69,6 @@ class observer : public cppa::attachable
...
@@ -62,8 +69,6 @@ class observer : public cppa::attachable
}
// namespace <anonymous>
}
// namespace <anonymous>
namespace
cppa
{
const
self_type
&
operator
<<
(
const
self_type
&
s
,
const
any_tuple
&
what
)
const
self_type
&
operator
<<
(
const
self_type
&
s
,
const
any_tuple
&
what
)
{
{
local_actor
*
sptr
=
s
;
local_actor
*
sptr
=
s
;
...
@@ -120,7 +125,7 @@ void unlink(actor_ptr& lhs, actor_ptr& rhs)
...
@@ -120,7 +125,7 @@ void unlink(actor_ptr& lhs, actor_ptr& rhs)
void
monitor
(
actor_ptr
&
whom
)
void
monitor
(
actor_ptr
&
whom
)
{
{
if
(
whom
)
whom
->
attach
(
new
observer
(
actor_ptr
(
self
)
));
if
(
whom
)
whom
->
attach
(
new
down_observer
(
self
,
whom
));
}
}
void
monitor
(
actor_ptr
&&
whom
)
void
monitor
(
actor_ptr
&&
whom
)
...
@@ -131,7 +136,7 @@ void monitor(actor_ptr&& whom)
...
@@ -131,7 +136,7 @@ void monitor(actor_ptr&& whom)
void
demonitor
(
actor_ptr
&
whom
)
void
demonitor
(
actor_ptr
&
whom
)
{
{
attachable
::
token
mtoken
(
typeid
(
observer
),
self
);
attachable
::
token
mtoken
(
typeid
(
down_
observer
),
self
);
if
(
whom
)
whom
->
detach
(
mtoken
);
if
(
whom
)
whom
->
detach
(
mtoken
);
}
}
...
...
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