Commit acedc6fc authored by Dominik Charousset's avatar Dominik Charousset

Remove duplicate for mailbox_based

parent 870a3304
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
#include <functional> #include <functional>
#include "caf/local_actor.hpp" #include "caf/local_actor.hpp"
#include "caf/mailbox_based.hpp"
#include "caf/mailbox_element.hpp" #include "caf/mailbox_element.hpp"
#include "caf/behavior_stack_based.hpp"
#include "caf/mixin/sync_sender.hpp" #include "caf/mixin/sync_sender.hpp"
#include "caf/mixin/behavior_stack_based.hpp"
#include "caf/detail/memory.hpp" #include "caf/detail/memory.hpp"
#include "caf/detail/shared_spinlock.hpp" #include "caf/detail/shared_spinlock.hpp"
...@@ -40,7 +39,7 @@ namespace caf { ...@@ -40,7 +39,7 @@ namespace caf {
* allow any object to interact with other actors. * allow any object to interact with other actors.
*/ */
class actor_companion : public extend<local_actor, actor_companion>:: class actor_companion : public extend<local_actor, actor_companion>::
with<behavior_stack_based<behavior>::impl, with<mixin::behavior_stack_based<behavior>::impl,
mixin::sync_sender<nonblocking_response_handle_tag>::impl> { mixin::sync_sender<nonblocking_response_handle_tag>::impl> {
using lock_type = detail::shared_spinlock; using lock_type = detail::shared_spinlock;
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the Boost Software License, Version 1.0. See *
* accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt *
\******************************************************************************/
#ifndef CAF_MAILBOX_BASED_HPP
#define CAF_MAILBOX_BASED_HPP
#include <type_traits>
#include "caf/mailbox_element.hpp"
#include "caf/detail/sync_request_bouncer.hpp"
#include "caf/detail/single_reader_queue.hpp"
namespace caf {
template<class Base, class Subtype>
class mailbox_based : public Base {
using del = detail::disposer;
public:
~mailbox_based() {
if (!m_mailbox.closed()) {
detail::sync_request_bouncer f{this->exit_reason()};
m_mailbox.close(f);
}
}
template<typename... Ts>
inline mailbox_element* new_mailbox_element(Ts&&... args) {
return mailbox_element::create(std::forward<Ts>(args)...);
}
void cleanup(std::uint32_t reason) override {
detail::sync_request_bouncer f{reason};
m_mailbox.close(f);
Base::cleanup(reason);
}
protected:
using combined_type = mailbox_based;
using mailbox_type = detail::single_reader_queue<mailbox_element, del>;
template<typename... Ts>
mailbox_based(Ts&&... args) : Base(std::forward<Ts>(args)...) { }
mailbox_type m_mailbox;
};
} // namespace caf
#endif //CAF_MAILBOX_BASED_HPP
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