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
90a9c015
Commit
90a9c015
authored
Mar 07, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend registry lifetime over scheduler lifetime
parent
75be7f62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
libcaf_core/src/actor_registry.cpp
libcaf_core/src/actor_registry.cpp
+19
-13
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+2
-2
No files found.
libcaf_core/src/actor_registry.cpp
View file @
90a9c015
...
...
@@ -283,20 +283,26 @@ void actor_registry::start() {
}
void
actor_registry
::
stop
()
{
scoped_actor
self
{
system_
,
true
};
try
{
for
(
auto
&
kvp
:
named_entries_
)
{
self
->
monitor
(
kvp
.
second
);
self
->
send_exit
(
kvp
.
second
,
exit_reason
::
kill
);
self
->
receive
(
[](
const
down_msg
&
)
{
// nop
}
);
class
dropping_execution_unit
:
public
execution_unit
{
public:
dropping_execution_unit
(
actor_system
*
sys
)
:
execution_unit
(
sys
)
{
// nop
}
}
catch
(
actor_exited
&
)
{
CAF_LOG_ERROR
(
"actor_exited thrown in actor_registry::stop"
);
void
exec_later
(
resumable
*
)
override
{
// should not happen in the first place
CAF_LOG_ERROR
(
"actor registry actor called exec_later during shutdown"
);
}
};
// the scheduler is already stopped -> invoke exit messages manually
dropping_execution_unit
dummy
{
&
system_
};
for
(
auto
&
kvp
:
named_entries_
)
{
auto
mp
=
mailbox_element
::
make_joint
(
invalid_actor_addr
,
invalid_message_id
,
{},
exit_msg
{
invalid_actor_addr
,
exit_reason
::
kill
});
auto
ptr
=
static_cast
<
local_actor
*>
(
actor_cast
<
abstract_actor
*>
(
kvp
.
second
));
ptr
->
exec_single_event
(
&
dummy
,
mp
);
}
named_entries_
.
clear
();
}
...
...
libcaf_core/src/actor_system.cpp
View file @
90a9c015
...
...
@@ -127,10 +127,10 @@ actor_system::actor_system(actor_system_config&& cfg)
node_
.
swap
(
cfg
.
network_id
);
// fire up remaining modules
logger_
.
start
();
registry_
.
start
();
for
(
auto
&
mod
:
modules_
)
if
(
mod
)
mod
->
start
();
registry_
.
start
();
// store config parameters in ConfigServ
auto
cs
=
registry_
.
get
(
atom
(
"ConfigServ"
));
anon_send
(
cs
,
put_atom
::
value
,
"middleman.enable-automatic-connections"
,
...
...
@@ -141,10 +141,10 @@ actor_system::~actor_system() {
if
(
await_actors_before_shutdown_
)
await_all_actors_done
();
// stop modules in reverse order
registry_
.
stop
();
for
(
auto
i
=
modules_
.
rbegin
();
i
!=
modules_
.
rend
();
++
i
)
if
(
*
i
)
(
*
i
)
->
stop
();
registry_
.
stop
();
logger_
.
stop
();
CAF_SET_LOGGER_SYS
(
nullptr
);
}
...
...
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