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
5e9d12cf
Commit
5e9d12cf
authored
Jun 18, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decrease running actor count correctly
parent
9bea72e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
src/io_actor.cpp
src/io_actor.cpp
+7
-1
src/io_actor_backend.cpp
src/io_actor_backend.cpp
+14
-4
No files found.
src/io_actor.cpp
View file @
5e9d12cf
...
...
@@ -29,6 +29,7 @@
#include "cppa/singletons.hpp"
#include "cppa/detail/actor_registry.hpp"
#include "cppa/network/io_actor.hpp"
#include "cppa/network/middleman.hpp"
...
...
@@ -45,7 +46,9 @@ class io_actor_continuation {
io_actor_continuation
(
io_actor_ptr
ptr
,
mailbox_element
*
elem
)
:
m_self
(
std
::
move
(
ptr
)),
m_elem
(
elem
)
{
}
void
operator
()()
const
{
m_self
->
invoke_message
(
m_elem
);
}
void
operator
()()
const
{
m_self
->
invoke_message
(
m_elem
);
}
private:
...
...
@@ -97,6 +100,9 @@ void io_actor::invoke_message(mailbox_element* elem) {
CPPA_LOG_ERROR
(
"IO actor killed due to an unhandled exception"
);
quit
(
exit_reason
::
unhandled_exception
);
}
if
(
exit_reason
()
!=
exit_reason
::
not_exited
)
{
get_actor_registry
()
->
dec_running
();
}
}
void
io_actor
::
invoke_message
(
any_tuple
msg
)
{
...
...
src/io_actor_backend.cpp
View file @
5e9d12cf
...
...
@@ -28,6 +28,8 @@
\******************************************************************************/
#include <iostream>
#include "cppa/singletons.hpp"
#include "cppa/network/middleman.hpp"
...
...
@@ -51,8 +53,8 @@ io_actor_backend::io_actor_backend(input_stream_ptr in,
}
io_actor_backend
::~
io_actor_backend
()
{
std
::
cout
<<
"~io_actor_backend"
<<
std
::
endl
;
handle_disconnect
();
get_actor_registry
()
->
dec_running
();
}
void
io_actor_backend
::
init
()
{
...
...
@@ -64,11 +66,19 @@ void io_actor_backend::init() {
void
io_actor_backend
::
handle_disconnect
()
{
if
(
m_self
)
{
auto
ms
=
m_self
;
m_self
.
reset
();
bool
dec_count
=
ms
->
exit_reason
()
==
exit_reason
::
not_exited
;
CPPA_LOG_DEBUG
(
"became disconnected"
);
if
(
m_self
->
exit_reason
()
==
exit_reason
::
not_exited
)
{
m_self
->
invoke_message
(
make_any_tuple
(
atom
(
"IO_closed"
)));
if
(
ms
->
exit_reason
()
==
exit_reason
::
not_exited
)
{
ms
->
invoke_message
(
make_any_tuple
(
atom
(
"IO_closed"
)));
}
get_middleman
()
->
stop_reader
(
this
);
if
(
dec_count
)
{
if
(
ms
->
exit_reason
()
!=
exit_reason
::
not_exited
)
{
get_actor_registry
()
->
dec_running
();
}
}
m_self
.
reset
();
}
}
...
...
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