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
89e18d3d
Commit
89e18d3d
authored
Aug 24, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
execute cleanup on normal exit
parent
03ab7799
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
src/scheduled_actor.cpp
src/scheduled_actor.cpp
+19
-7
No files found.
src/scheduled_actor.cpp
View file @
89e18d3d
...
...
@@ -27,14 +27,26 @@ scheduled_actor::~scheduled_actor()
delete
m_behavior
;
}
void
scheduled_actor
::
run
(
void
*
_this
)
void
scheduled_actor
::
run
(
void
*
ptr_arg
)
{
auto
m_behavior
=
reinterpret_cast
<
scheduled_actor
*>
(
_this
)
->
m_behavior
;
if
(
m_behavior
)
auto
this_ptr
=
reinterpret_cast
<
scheduled_actor
*>
(
ptr_arg
);
auto
behavior_ptr
=
this_ptr
->
m_behavior
;
if
(
behavior_ptr
)
{
try
{
m_behavior
->
act
();
}
catch
(...)
{
}
try
{
m_behavior
->
on_exit
();
}
bool
cleanup_called
=
false
;
try
{
behavior_ptr
->
act
();
}
catch
(
actor_exited
&
)
{
// cleanup already called by scheduled_actor::quit
cleanup_called
=
true
;
}
catch
(...)
{
this_ptr
->
cleanup
(
exit_reason
::
unhandled_exception
);
cleanup_called
=
true
;
}
if
(
!
cleanup_called
)
this_ptr
->
cleanup
(
exit_reason
::
normal
);
try
{
behavior_ptr
->
on_exit
();
}
catch
(...)
{
}
}
yield
(
yield_state
::
done
);
...
...
@@ -42,7 +54,7 @@ void scheduled_actor::run(void* _this)
void
scheduled_actor
::
quit
(
std
::
uint32_t
reason
)
{
super
::
cleanup
(
reason
);
cleanup
(
reason
);
throw
actor_exited
(
reason
);
//yield(yield_state::done);
}
...
...
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