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
7c40937c
Commit
7c40937c
authored
Aug 09, 2023
by
Samir Halilcevic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call dtor in disposable manually
parent
29879209
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
libcaf_core/caf/action.hpp
libcaf_core/caf/action.hpp
+1
-0
libcaf_core/caf/detail/dispose_on_call.hpp
libcaf_core/caf/detail/dispose_on_call.hpp
+3
-0
libcaf_core/caf/detail/thread_safe_actor_clock.cpp
libcaf_core/caf/detail/thread_safe_actor_clock.cpp
+5
-1
No files found.
libcaf_core/caf/action.hpp
View file @
7c40937c
...
@@ -133,6 +133,7 @@ struct default_action_impl : detail::atomic_ref_counted, action::impl {
...
@@ -133,6 +133,7 @@ struct default_action_impl : detail::atomic_ref_counted, action::impl {
void
dispose
()
override
{
void
dispose
()
override
{
state_
=
action
::
state
::
disposed
;
state_
=
action
::
state
::
disposed
;
f_
.
~
F
();
}
}
bool
disposed
()
const
noexcept
override
{
bool
disposed
()
const
noexcept
override
{
...
...
libcaf_core/caf/detail/dispose_on_call.hpp
View file @
7c40937c
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/disposable.hpp"
#include "caf/disposable.hpp"
#include <iostream>
namespace
caf
::
detail
{
namespace
caf
::
detail
{
template
<
class
Signature
>
template
<
class
Signature
>
...
@@ -17,6 +19,7 @@ struct dispose_on_call_t<R(Ts...)> {
...
@@ -17,6 +19,7 @@ struct dispose_on_call_t<R(Ts...)> {
template
<
class
F
>
template
<
class
F
>
auto
operator
()(
disposable
resource
,
F
f
)
{
auto
operator
()(
disposable
resource
,
F
f
)
{
return
[
resource
{
std
::
move
(
resource
)},
f
{
std
::
move
(
f
)}](
Ts
...
xs
)
mutable
{
return
[
resource
{
std
::
move
(
resource
)},
f
{
std
::
move
(
f
)}](
Ts
...
xs
)
mutable
{
std
::
cout
<<
"Disposing "
<<
resource
.
ptr
()
<<
std
::
endl
;
resource
.
dispose
();
resource
.
dispose
();
return
f
(
xs
...);
return
f
(
xs
...);
};
};
...
...
libcaf_core/caf/detail/thread_safe_actor_clock.cpp
View file @
7c40937c
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include "caf/system_messages.hpp"
#include "caf/system_messages.hpp"
#include "caf/thread_owner.hpp"
#include "caf/thread_owner.hpp"
#include <iostream>
namespace
caf
::
detail
{
namespace
caf
::
detail
{
thread_safe_actor_clock
::
thread_safe_actor_clock
()
{
thread_safe_actor_clock
::
thread_safe_actor_clock
()
{
...
@@ -19,7 +21,9 @@ thread_safe_actor_clock::thread_safe_actor_clock() {
...
@@ -19,7 +21,9 @@ thread_safe_actor_clock::thread_safe_actor_clock() {
disposable
thread_safe_actor_clock
::
schedule
(
time_point
abs_time
,
action
f
)
{
disposable
thread_safe_actor_clock
::
schedule
(
time_point
abs_time
,
action
f
)
{
queue_
.
emplace_back
(
schedule_entry_ptr
{
new
schedule_entry
{
abs_time
,
f
}});
queue_
.
emplace_back
(
schedule_entry_ptr
{
new
schedule_entry
{
abs_time
,
f
}});
return
std
::
move
(
f
).
as_disposable
();
auto
disp
=
std
::
move
(
f
).
as_disposable
();
std
::
cout
<<
"Making "
<<
disp
.
ptr
()
<<
std
::
endl
;
return
disp
;
}
}
void
thread_safe_actor_clock
::
run
()
{
void
thread_safe_actor_clock
::
run
()
{
...
...
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