Commit 2d0fb731 authored by Dominik Charousset's avatar Dominik Charousset

maintenance

parent 82ae3d32
...@@ -51,6 +51,8 @@ class event_based_actor : public event_based_actor_base<event_based_actor> ...@@ -51,6 +51,8 @@ class event_based_actor : public event_based_actor_base<event_based_actor>
public: public:
event_based_actor();
/** /**
* @brief Terminates this actor with normal exit reason. * @brief Terminates this actor with normal exit reason.
*/ */
......
...@@ -32,6 +32,11 @@ ...@@ -32,6 +32,11 @@
namespace cppa { namespace cppa {
event_based_actor::event_based_actor()
{
m_loop_stack.reserve(2);
}
void event_based_actor::become_void() void event_based_actor::become_void()
{ {
cleanup(exit_reason::normal); cleanup(exit_reason::normal);
...@@ -54,19 +59,19 @@ void event_based_actor::do_become(behavior* bhvr, bool has_ownership) ...@@ -54,19 +59,19 @@ void event_based_actor::do_become(behavior* bhvr, bool has_ownership)
{ {
reset_timeout(); reset_timeout();
request_timeout(bhvr->timeout()); request_timeout(bhvr->timeout());
stack_element se{bhvr}; stack_element new_element{bhvr};
if (!has_ownership) se.get_deleter().disable(); if (!has_ownership) new_element.get_deleter().disable();
// keep always the latest element in the stack to prevent subtle errors, // keep always the latest element in the stack to prevent subtle errors,
// e.g., the addresses of all variables in a lambda expression calling // e.g., the addresses of all variables in a lambda expression calling
// become() suddenly are invalid if we would pop the behavior! // become() suddenly are invalid if we would pop the behavior!
if (m_loop_stack.size() < 2) if (m_loop_stack.size() < 2)
{ {
m_loop_stack.push_back(std::move(se)); m_loop_stack.push_back(std::move(new_element));
} }
else else
{ {
m_loop_stack[0] = std::move(m_loop_stack[1]); m_loop_stack[0] = std::move(m_loop_stack[1]);
m_loop_stack[1] = std::move(se); m_loop_stack[1] = std::move(new_element);
} }
} }
......
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