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
ea445eaf
Commit
ea445eaf
authored
Jan 11, 2016
by
ufownl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation error on gcc4.8
parent
00fba105
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
libcaf_core/caf/monitorable_actor.hpp
libcaf_core/caf/monitorable_actor.hpp
+4
-4
libcaf_core/src/monitorable_actor.cpp
libcaf_core/src/monitorable_actor.cpp
+19
-19
No files found.
libcaf_core/caf/monitorable_actor.hpp
View file @
ea445eaf
...
...
@@ -53,6 +53,10 @@ public:
/// @cond PRIVATE
/// Called by the runtime system to perform cleanup actions for this actor.
/// Subtypes should always call this member function when overriding it.
virtual
void
cleanup
(
exit_reason
reason
,
execution_unit
*
host
);
// Returns `exit_reason_ != exit_reason::not_exited`.
inline
bool
exited
()
const
{
return
exit_reason_
!=
exit_reason
::
not_exited
;
...
...
@@ -70,10 +74,6 @@ protected:
/// Creates a new actor instance.
monitorable_actor
(
actor_system
*
sys
,
actor_id
aid
,
node_id
nid
,
int
flags
);
/// Called by the runtime system to perform cleanup actions for this actor.
/// Subtypes should always call this member function when overriding it.
virtual
void
cleanup
(
exit_reason
reason
,
execution_unit
*
host
);
/****************************************************************************
* here be dragons: end of public interface *
****************************************************************************/
...
...
libcaf_core/src/monitorable_actor.cpp
View file @
ea445eaf
...
...
@@ -55,6 +55,25 @@ size_t monitorable_actor::detach(const attachable::token& what) {
return
detach_impl
(
what
,
attachables_head_
);
}
void
monitorable_actor
::
cleanup
(
exit_reason
reason
,
execution_unit
*
host
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
CAF_ASSERT
(
reason
!=
exit_reason
::
not_exited
);
// move everyhting out of the critical section before processing it
attachable_ptr
head
;
{
// lifetime scope of guard
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
if
(
exit_reason_
!=
exit_reason
::
not_exited
)
return
;
exit_reason_
=
reason
;
attachables_head_
.
swap
(
head
);
}
CAF_LOG_INFO_IF
(
host
&&
host
->
system
().
node
()
==
node
(),
"cleanup"
<<
CAF_ARG
(
id
())
<<
CAF_ARG
(
reason
));
// send exit messages
for
(
attachable
*
i
=
head
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
i
->
actor_exited
(
this
,
reason
,
host
);
}
monitorable_actor
::
monitorable_actor
(
actor_config
&
cfg
)
:
abstract_actor
(
cfg
),
exit_reason_
(
exit_reason
::
not_exited
)
{
...
...
@@ -76,25 +95,6 @@ monitorable_actor::monitorable_actor(actor_system* sys, actor_id aid,
// nop
}
void
monitorable_actor
::
cleanup
(
exit_reason
reason
,
execution_unit
*
host
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
CAF_ASSERT
(
reason
!=
exit_reason
::
not_exited
);
// move everyhting out of the critical section before processing it
attachable_ptr
head
;
{
// lifetime scope of guard
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
if
(
exit_reason_
!=
exit_reason
::
not_exited
)
return
;
exit_reason_
=
reason
;
attachables_head_
.
swap
(
head
);
}
CAF_LOG_INFO_IF
(
host
&&
host
->
system
().
node
()
==
node
(),
"cleanup"
<<
CAF_ARG
(
id
())
<<
CAF_ARG
(
reason
));
// send exit messages
for
(
attachable
*
i
=
head
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
i
->
actor_exited
(
this
,
reason
,
host
);
}
maybe
<
exit_reason
>
monitorable_actor
::
handle
(
const
std
::
exception_ptr
&
eptr
)
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
for
(
auto
i
=
attachables_head_
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
{
...
...
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