Commit 7c40937c authored by Samir Halilcevic's avatar Samir Halilcevic

Call dtor in disposable manually

parent 29879209
......@@ -133,6 +133,7 @@ struct default_action_impl : detail::atomic_ref_counted, action::impl {
void dispose() override {
state_ = action::state::disposed;
f_.~F();
}
bool disposed() const noexcept override {
......
......@@ -7,6 +7,8 @@
#include "caf/detail/type_traits.hpp"
#include "caf/disposable.hpp"
#include <iostream>
namespace caf::detail {
template <class Signature>
......@@ -17,6 +19,7 @@ struct dispose_on_call_t<R(Ts...)> {
template <class F>
auto operator()(disposable resource, F f) {
return [resource{std::move(resource)}, f{std::move(f)}](Ts... xs) mutable {
std::cout << "Disposing " << resource.ptr() << std::endl;
resource.dispose();
return f(xs...);
};
......
......@@ -11,6 +11,8 @@
#include "caf/system_messages.hpp"
#include "caf/thread_owner.hpp"
#include <iostream>
namespace caf::detail {
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) {
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() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment