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
43f75506
Commit
43f75506
authored
Aug 22, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
relaxed signatures of link and monitor related member functions of class actor
parent
e94ebf05
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
68 deletions
+27
-68
cppa/actor.hpp
cppa/actor.hpp
+4
-25
cppa/actor_proxy.hpp
cppa/actor_proxy.hpp
+6
-6
cppa/detail/abstract_actor.hpp
cppa/detail/abstract_actor.hpp
+6
-6
src/actor.cpp
src/actor.cpp
+0
-20
src/actor_proxy.cpp
src/actor_proxy.cpp
+11
-11
No files found.
cppa/actor.hpp
View file @
43f75506
...
@@ -127,14 +127,14 @@ class actor : public channel {
...
@@ -127,14 +127,14 @@ class actor : public channel {
* @param other Actor instance that whose execution is coupled to the
* @param other Actor instance that whose execution is coupled to the
* execution of this Actor.
* execution of this Actor.
*/
*/
virtual
void
link_to
(
intrusive_ptr
<
actor
>&
other
)
=
0
;
virtual
void
link_to
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
/**
/**
* @brief Unlinks this actor from @p other.
* @brief Unlinks this actor from @p other.
* @param other Linked Actor.
* @param other Linked Actor.
* @note Links are automatically removed if the Actor finishes execution.
* @note Links are automatically removed if the Actor finishes execution.
*/
*/
virtual
void
unlink_from
(
intrusive_ptr
<
actor
>&
other
)
=
0
;
virtual
void
unlink_from
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
/**
/**
* @brief Establishes a link relation between this actor and @p other.
* @brief Establishes a link relation between this actor and @p other.
...
@@ -142,7 +142,7 @@ class actor : public channel {
...
@@ -142,7 +142,7 @@ class actor : public channel {
* @returns @c true if this actor is running and added @p other to its
* @returns @c true if this actor is running and added @p other to its
* list of linked actors; otherwise @c false.
* list of linked actors; otherwise @c false.
*/
*/
virtual
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
other
)
=
0
;
virtual
bool
establish_backlink
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
/**
/**
* @brief Removes a link relation between this actor and @p other.
* @brief Removes a link relation between this actor and @p other.
...
@@ -150,28 +150,7 @@ class actor : public channel {
...
@@ -150,28 +150,7 @@ class actor : public channel {
* @returns @c true if this actor is running and removed @p other
* @returns @c true if this actor is running and removed @p other
* from its list of linked actors; otherwise @c false.
* from its list of linked actors; otherwise @c false.
*/
*/
virtual
bool
remove_backlink
(
intrusive_ptr
<
actor
>&
other
)
=
0
;
virtual
bool
remove_backlink
(
const
intrusive_ptr
<
actor
>&
other
)
=
0
;
// rvalue support
/**
* @copydoc link_to(intrusive_ptr<actor>&)
*/
void
link_to
(
intrusive_ptr
<
actor
>&&
other
);
/**
* @copydoc :unlink_from(intrusive_ptr<actor>&)
*/
void
unlink_from
(
intrusive_ptr
<
actor
>&&
other
);
/**
* @copydoc remove_backlink(intrusive_ptr<actor>&)
*/
bool
remove_backlink
(
intrusive_ptr
<
actor
>&&
other
);
/**
* @copydoc establish_backlink(intrusive_ptr<actor>&)
*/
bool
establish_backlink
(
intrusive_ptr
<
actor
>&&
other
);
/**
/**
* @brief Gets the {@link process_information} of the parent process.
* @brief Gets the {@link process_information} of the parent process.
...
...
cppa/actor_proxy.hpp
View file @
43f75506
...
@@ -57,21 +57,21 @@ class actor_proxy : public detail::abstract_actor<actor> {
...
@@ -57,21 +57,21 @@ class actor_proxy : public detail::abstract_actor<actor> {
void
sync_enqueue
(
actor
*
sender
,
message_id_t
id
,
any_tuple
msg
);
void
sync_enqueue
(
actor
*
sender
,
message_id_t
id
,
any_tuple
msg
);
void
link_to
(
intrusive_ptr
<
actor
>&
other
);
void
link_to
(
const
intrusive_ptr
<
actor
>&
other
);
// do not cause to send this actor an "UNLINK" message
// do not cause to send this actor an "UNLINK" message
// to the "original" remote actor
// to the "original" remote actor
void
local_link_to
(
intrusive_ptr
<
actor
>&
other
);
void
local_link_to
(
const
intrusive_ptr
<
actor
>&
other
);
void
unlink_from
(
intrusive_ptr
<
actor
>&
other
);
void
unlink_from
(
const
intrusive_ptr
<
actor
>&
other
);
// do not cause to send this actor an "UNLINK" message
// do not cause to send this actor an "UNLINK" message
// to the "original" remote actor
// to the "original" remote actor
void
local_unlink_from
(
intrusive_ptr
<
actor
>
&
other
);
void
local_unlink_from
(
const
actor_ptr
&
other
);
bool
remove_backlink
(
intrusive_ptr
<
actor
>&
to
);
bool
remove_backlink
(
const
intrusive_ptr
<
actor
>&
to
);
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
to
);
bool
establish_backlink
(
const
intrusive_ptr
<
actor
>&
to
);
};
};
...
...
cppa/detail/abstract_actor.hpp
View file @
43f75506
...
@@ -139,15 +139,15 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
...
@@ -139,15 +139,15 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
// uptr will be destroyed here, without locked mutex
// uptr will be destroyed here, without locked mutex
}
}
void
link_to
(
intrusive_ptr
<
actor
>&
other
)
{
// override
void
link_to
(
const
intrusive_ptr
<
actor
>&
other
)
{
(
void
)
link_to_impl
(
other
);
(
void
)
link_to_impl
(
other
);
}
}
void
unlink_from
(
intrusive_ptr
<
actor
>&
other
)
{
// override
void
unlink_from
(
const
intrusive_ptr
<
actor
>&
other
)
{
(
void
)
unlink_from_impl
(
other
);
(
void
)
unlink_from_impl
(
other
);
}
}
bool
remove_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
// override
bool
remove_backlink
(
const
intrusive_ptr
<
actor
>&
other
)
{
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
guard_type
guard
(
m_mtx
);
guard_type
guard
(
m_mtx
);
auto
i
=
std
::
find
(
m_links
.
begin
(),
m_links
.
end
(),
other
);
auto
i
=
std
::
find
(
m_links
.
begin
(),
m_links
.
end
(),
other
);
...
@@ -159,7 +159,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
...
@@ -159,7 +159,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
return
false
;
return
false
;
}
}
bool
establish_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
// override
bool
establish_backlink
(
const
intrusive_ptr
<
actor
>&
other
)
{
std
::
uint32_t
reason
=
exit_reason
::
not_exited
;
std
::
uint32_t
reason
=
exit_reason
::
not_exited
;
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
guard_type
guard
(
m_mtx
);
guard_type
guard
(
m_mtx
);
...
@@ -252,7 +252,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
...
@@ -252,7 +252,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
}
}
}
}
bool
link_to_impl
(
intrusive_ptr
<
actor
>&
other
)
{
bool
link_to_impl
(
const
intrusive_ptr
<
actor
>&
other
)
{
if
(
other
&&
other
!=
this
)
{
if
(
other
&&
other
!=
this
)
{
guard_type
guard
(
m_mtx
);
guard_type
guard
(
m_mtx
);
// send exit message if already exited
// send exit message if already exited
...
@@ -270,7 +270,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
...
@@ -270,7 +270,7 @@ class abstract_actor : public abstract_actor_base<Base, std::is_base_of<local_ac
return
false
;
return
false
;
}
}
bool
unlink_from_impl
(
intrusive_ptr
<
actor
>&
other
)
{
bool
unlink_from_impl
(
const
intrusive_ptr
<
actor
>&
other
)
{
guard_type
guard
(
m_mtx
);
guard_type
guard
(
m_mtx
);
// remove_backlink returns true if this actor is linked to other
// remove_backlink returns true if this actor is linked to other
if
(
other
&&
!
exited
()
&&
other
->
remove_backlink
(
this
))
{
if
(
other
&&
!
exited
()
&&
other
->
remove_backlink
(
this
))
{
...
...
src/actor.cpp
View file @
43f75506
...
@@ -78,24 +78,4 @@ actor::actor(const process_information_ptr& pptr)
...
@@ -78,24 +78,4 @@ actor::actor(const process_information_ptr& pptr)
}
}
}
}
void
actor
::
link_to
(
intrusive_ptr
<
actor
>&&
other
)
{
intrusive_ptr
<
actor
>
tmp
(
std
::
move
(
other
));
link_to
(
tmp
);
}
void
actor
::
unlink_from
(
intrusive_ptr
<
actor
>&&
other
)
{
intrusive_ptr
<
actor
>
tmp
(
std
::
move
(
other
));
unlink_from
(
tmp
);
}
bool
actor
::
remove_backlink
(
intrusive_ptr
<
actor
>&&
to
)
{
intrusive_ptr
<
actor
>
tmp
(
std
::
move
(
to
));
return
remove_backlink
(
tmp
);
}
bool
actor
::
establish_backlink
(
intrusive_ptr
<
actor
>&&
to
)
{
intrusive_ptr
<
actor
>
tmp
(
std
::
move
(
to
));
return
establish_backlink
(
tmp
);
}
}
// namespace cppa
}
// namespace cppa
src/actor_proxy.cpp
View file @
43f75506
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "cppa/actor_proxy.hpp"
#include "cppa/actor_proxy.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/exit_reason.hpp"
#include "cppa/detail/middleman.hpp"
#include "cppa/detail/middleman.hpp"
#include "cppa/detail/types_array.hpp"
#include "cppa/detail/network_manager.hpp"
#include "cppa/detail/network_manager.hpp"
#include "cppa/detail/singleton_manager.hpp"
#include "cppa/detail/singleton_manager.hpp"
...
@@ -45,15 +46,14 @@ namespace cppa {
...
@@ -45,15 +46,14 @@ namespace cppa {
using
detail
::
middleman_enqueue
;
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());
}
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
void
actor_proxy
::
enqueue
(
actor
*
sender
,
any_tuple
msg
)
{
auto
&
arr
=
detail
::
static_types_array
<
atom_value
,
std
::
uint32_t
>::
arr
;
if
(
msg
.
size
()
==
2
if
(
msg
.
size
()
==
2
&&
*
(
msg
.
type_at
(
0
))
==
typeid
(
atom_value
)
&&
msg
.
type_at
(
0
)
==
arr
[
0
]
&&
msg
.
get_as
<
atom_value
>
(
0
)
==
atom
(
"KILL_PROXY"
)
&&
msg
.
get_as
<
atom_value
>
(
0
)
==
atom
(
"KILL_PROXY"
)
&&
*
(
msg
.
type_at
(
1
))
==
typeid
(
std
::
uint32_t
)
)
{
&&
msg
.
type_at
(
1
)
==
arr
[
1
]
)
{
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
cleanup
(
msg
.
get_as
<
std
::
uint32_t
>
(
1
));
return
;
return
;
}
}
...
@@ -64,7 +64,7 @@ void actor_proxy::sync_enqueue(actor* sender, message_id_t id, any_tuple msg) {
...
@@ -64,7 +64,7 @@ void actor_proxy::sync_enqueue(actor* sender, message_id_t id, any_tuple msg) {
middleman_enqueue
(
parent_process_ptr
(),
sender
,
this
,
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
(
const
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
middleman_enqueue
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
...
@@ -74,11 +74,11 @@ void actor_proxy::link_to(intrusive_ptr<actor>& other) {
...
@@ -74,11 +74,11 @@ void actor_proxy::link_to(intrusive_ptr<actor>& other) {
}
}
}
}
void
actor_proxy
::
local_link_to
(
intrusive_ptr
<
actor
>&
other
)
{
void
actor_proxy
::
local_link_to
(
const
intrusive_ptr
<
actor
>&
other
)
{
link_to_impl
(
other
);
link_to_impl
(
other
);
}
}
void
actor_proxy
::
unlink_from
(
intrusive_ptr
<
actor
>&
other
)
{
void
actor_proxy
::
unlink_from
(
const
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
middleman_enqueue
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
...
@@ -88,11 +88,11 @@ void actor_proxy::unlink_from(intrusive_ptr<actor>& other) {
...
@@ -88,11 +88,11 @@ void actor_proxy::unlink_from(intrusive_ptr<actor>& other) {
}
}
}
}
void
actor_proxy
::
local_unlink_from
(
intrusive_ptr
<
actor
>&
other
)
{
void
actor_proxy
::
local_unlink_from
(
const
intrusive_ptr
<
actor
>&
other
)
{
unlink_from_impl
(
other
);
unlink_from_impl
(
other
);
}
}
bool
actor_proxy
::
establish_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
bool
actor_proxy
::
establish_backlink
(
const
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
...
@@ -104,7 +104,7 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
...
@@ -104,7 +104,7 @@ bool actor_proxy::establish_backlink(intrusive_ptr<actor>& other) {
return
result
;
return
result
;
}
}
bool
actor_proxy
::
remove_backlink
(
intrusive_ptr
<
actor
>&
other
)
{
bool
actor_proxy
::
remove_backlink
(
const
intrusive_ptr
<
actor
>&
other
)
{
bool
result
=
super
::
remove_backlink
(
other
);
bool
result
=
super
::
remove_backlink
(
other
);
if
(
result
)
{
if
(
result
)
{
middleman_enqueue
(
parent_process_ptr
(),
middleman_enqueue
(
parent_process_ptr
(),
...
...
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