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
a481bdbf
Commit
a481bdbf
authored
Jan 11, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #405 from ufownl/topic/fix_compilation_error
Fix compilation error on gcc4.8
parents
00fba105
ea445eaf
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 @
a481bdbf
...
@@ -53,6 +53,10 @@ public:
...
@@ -53,6 +53,10 @@ public:
/// @cond PRIVATE
/// @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`.
// Returns `exit_reason_ != exit_reason::not_exited`.
inline
bool
exited
()
const
{
inline
bool
exited
()
const
{
return
exit_reason_
!=
exit_reason
::
not_exited
;
return
exit_reason_
!=
exit_reason
::
not_exited
;
...
@@ -70,10 +74,6 @@ protected:
...
@@ -70,10 +74,6 @@ protected:
/// Creates a new actor instance.
/// Creates a new actor instance.
monitorable_actor
(
actor_system
*
sys
,
actor_id
aid
,
node_id
nid
,
int
flags
);
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 *
* here be dragons: end of public interface *
****************************************************************************/
****************************************************************************/
...
...
libcaf_core/src/monitorable_actor.cpp
View file @
a481bdbf
...
@@ -55,6 +55,25 @@ size_t monitorable_actor::detach(const attachable::token& what) {
...
@@ -55,6 +55,25 @@ size_t monitorable_actor::detach(const attachable::token& what) {
return
detach_impl
(
what
,
attachables_head_
);
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
)
monitorable_actor
::
monitorable_actor
(
actor_config
&
cfg
)
:
abstract_actor
(
cfg
),
:
abstract_actor
(
cfg
),
exit_reason_
(
exit_reason
::
not_exited
)
{
exit_reason_
(
exit_reason
::
not_exited
)
{
...
@@ -76,25 +95,6 @@ monitorable_actor::monitorable_actor(actor_system* sys, actor_id aid,
...
@@ -76,25 +95,6 @@ monitorable_actor::monitorable_actor(actor_system* sys, actor_id aid,
// nop
// 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
)
{
maybe
<
exit_reason
>
monitorable_actor
::
handle
(
const
std
::
exception_ptr
&
eptr
)
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
for
(
auto
i
=
attachables_head_
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
{
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