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
07f00977
Commit
07f00977
authored
Aug 16, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added convenience overload to middleman_enqueue and use it consistently in actor_proxy
parent
9763e6fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
27 deletions
+30
-27
cppa/actor_proxy.hpp
cppa/actor_proxy.hpp
+0
-5
cppa/detail/middleman.hpp
cppa/detail/middleman.hpp
+10
-0
src/actor_proxy.cpp
src/actor_proxy.cpp
+20
-22
No files found.
cppa/actor_proxy.hpp
View file @
07f00977
...
@@ -73,11 +73,6 @@ class actor_proxy : public detail::abstract_actor<actor> {
...
@@ -73,11 +73,6 @@ class actor_proxy : public detail::abstract_actor<actor> {
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
to
);
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
to
);
void
forward_message
(
const
process_information_ptr
&
,
actor
*
,
any_tuple
&&
,
message_id_t
=
message_id_t
()
);
};
};
#endif // CPPA_DOCUMENTATION
#endif // CPPA_DOCUMENTATION
...
...
cppa/detail/middleman.hpp
View file @
07f00977
...
@@ -104,6 +104,16 @@ inline void middleman_enqueue(process_information_ptr peer,
...
@@ -104,6 +104,16 @@ inline void middleman_enqueue(process_information_ptr peer,
send2mm
(
std
::
move
(
peer
),
std
::
move
(
outgoing_message
));
send2mm
(
std
::
move
(
peer
),
std
::
move
(
outgoing_message
));
}
}
inline
void
middleman_enqueue
(
process_information_ptr
peer
,
actor_ptr
sender
,
channel_ptr
receiver
,
any_tuple
&&
msg
,
message_id_t
id
=
message_id_t
())
{
addressed_message
amsg
(
std
::
move
(
sender
),
std
::
move
(
receiver
),
std
::
move
(
msg
),
id
);
send2mm
(
std
::
move
(
peer
),
std
::
move
(
amsg
));
}
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
#endif // MIDDLEMAN_HPP
#endif // MIDDLEMAN_HPP
src/actor_proxy.cpp
View file @
07f00977
...
@@ -42,19 +42,13 @@
...
@@ -42,19 +42,13 @@
namespace
cppa
{
namespace
cppa
{
using
detail
::
middleman_enqueue
;
actor_proxy
::
actor_proxy
(
std
::
uint32_t
mid
,
const
process_information_ptr
&
pptr
)
actor_proxy
::
actor_proxy
(
std
::
uint32_t
mid
,
const
process_information_ptr
&
pptr
)
:
super
(
mid
,
pptr
)
{
:
super
(
mid
,
pptr
)
{
//attach(get_scheduler()->register_hidden_context());
//attach(get_scheduler()->register_hidden_context());
}
}
void
actor_proxy
::
forward_message
(
const
process_information_ptr
&
piptr
,
actor
*
sender
,
any_tuple
&&
msg
,
message_id_t
id
)
{
detail
::
addressed_message
amsg
{
sender
,
this
,
std
::
move
(
msg
),
id
};
detail
::
middleman_enqueue
(
piptr
,
std
::
move
(
amsg
));
}
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
if
(
msg
.
size
()
==
2
if
(
msg
.
size
()
==
2
&&
*
(
msg
.
type_at
(
0
))
==
typeid
(
atom_value
)
&&
*
(
msg
.
type_at
(
0
))
==
typeid
(
atom_value
)
...
@@ -63,19 +57,20 @@ void actor_proxy::enqueue(actor* sender, any_tuple msg) {
...
@@ -63,19 +57,20 @@ void actor_proxy::enqueue(actor* sender, any_tuple msg) {
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
return
;
return
;
}
}
forward_message
(
parent_process_ptr
(),
sender
,
std
::
move
(
msg
));
middleman_enqueue
(
parent_process_ptr
(),
sender
,
this
,
std
::
move
(
msg
));
}
}
void
actor_proxy
::
sync_enqueue
(
actor
*
sender
,
message_id_t
id
,
any_tuple
msg
)
{
void
actor_proxy
::
sync_enqueue
(
actor
*
sender
,
message_id_t
id
,
any_tuple
msg
)
{
forward_message
(
parent_process_ptr
(),
sender
,
std
::
move
(
msg
),
id
);
middleman_enqueue
(
parent_process_ptr
(),
sender
,
this
,
std
::
move
(
msg
),
id
);
}
}
void
actor_proxy
::
link_to
(
intrusive_ptr
<
actor
>&
other
)
{
void
actor_proxy
::
link_to
(
intrusive_ptr
<
actor
>&
other
)
{
if
(
link_to_impl
(
other
))
{
if
(
link_to_impl
(
other
))
{
// causes remote actor to link to (proxy of) other
// causes remote actor to link to (proxy of) other
forward_message
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
other
.
get
(),
other
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
this
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
}
}
}
}
...
@@ -86,9 +81,10 @@ void actor_proxy::local_link_to(intrusive_ptr<actor>& other) {
...
@@ -86,9 +81,10 @@ void actor_proxy::local_link_to(intrusive_ptr<actor>& other) {
void
actor_proxy
::
unlink_from
(
intrusive_ptr
<
actor
>&
other
)
{
void
actor_proxy
::
unlink_from
(
intrusive_ptr
<
actor
>&
other
)
{
if
(
unlink_from_impl
(
other
))
{
if
(
unlink_from_impl
(
other
))
{
// causes remote actor to unlink from (proxy of) other
// causes remote actor to unlink from (proxy of) other
forward_message
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
other
.
get
(),
other
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
this
,
make_any_tuple
(
atom
(
"UNLINK"
),
other
));
}
}
}
}
...
@@ -100,9 +96,10 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
...
@@ -100,9 +96,10 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
bool
result
=
super
::
establish_backlink
(
other
);
bool
result
=
super
::
establish_backlink
(
other
);
if
(
result
)
{
if
(
result
)
{
// causes remote actor to unlink from (proxy of) other
// causes remote actor to unlink from (proxy of) other
forward_message
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
other
.
get
(),
other
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
this
,
make_any_tuple
(
atom
(
"LINK"
),
other
));
}
}
return
result
;
return
result
;
}
}
...
@@ -110,9 +107,10 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
...
@@ -110,9 +107,10 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
bool
actor_proxy
::
remove_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
bool
actor_proxy
::
remove_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
bool
result
=
super
::
remove_backlink
(
other
);
bool
result
=
super
::
remove_backlink
(
other
);
if
(
result
)
{
if
(
result
)
{
forward_message
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
nullptr
,
nullptr
,
make_any_tuple
(
atom
(
"UNLINK"
),
actor_ptr
(
this
)));
this
,
make_any_tuple
(
atom
(
"UNLINK"
),
actor_ptr
(
this
)));
}
}
return
result
;
return
result
;
}
}
...
...
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