Пример #1
0
    bool operator< (const action_executor_interface& x) const {
      if (get_aid () != x.get_aid ()) {
	return get_aid () < x.get_aid ();
      }
      if (get_member_ptr () != x.get_member_ptr ()) {
	return get_member_ptr () < x.get_member_ptr ();
      }
      return get_pid () < x.get_pid ();
    }
Пример #2
0
///----------------------------------------------------------------------------
void coroutine_stackful_actor::free_self()
{
  aid_t self_aid = get_aid();
  base_type::update_aid();
  base_type::send_exit(self_aid, ec_, exit_msg_);
  user_->free_actor(this);
}
Пример #3
0
///----------------------------------------------------------------------------
void slice::free()
{
  aid_t self_aid = get_aid();
  base_type::update_aid();
  base_type::send_exit(self_aid, exit_normal, "exit normal");
  sire_->free_slice(this);
}
Пример #4
0
  tcp_connector_automaton::tcp_connector_automaton (const inet_address& address,
						    const automaton_handle<tcp_connection_automaton>& connection) :
    m_self (get_aid ()),
    m_connection (connection),
    m_errno (0),
    m_error_reported (false) {

    try {
      // Open a socket.
      m_fd = socket (AF_INET, SOCK_STREAM, 0);
      if (m_fd == -1) {
	m_errno = errno;
	throw std::exception ();
      }
      
      // Get the flags.
      int flags = fcntl (m_fd, F_GETFL, 0);
      if (flags < 0) {
	m_errno = errno;
	throw std::exception ();
      }
      
      // Set non-blocking.
      flags |= O_NONBLOCK;
      if (fcntl (m_fd, F_SETFL, flags) == -1) {
	m_errno = errno;
	throw std::exception ();
      }
      
      if (::connect (m_fd, address.get_sockaddr (), address.get_socklen ()) != -1) {
	automaton_manager<connection_init_automaton>* init = make_automaton_manager (this, make_allocator<connection_init_automaton> (m_connection, m_fd));
	make_binding_manager (this,
			      init, &connection_init_automaton::done,
			      &m_self, &tcp_connector_automaton::done);
	throw std::exception ();
      }
      else {
	if (errno == EINPROGRESS) {
	  // Asynchronous connect.
	  ioa::schedule_write_ready (&ioa::tcp_connector_automaton::write_ready, m_fd);
	}
	else {
	  m_errno = errno;
	  throw std::exception ();
	}
      }
    } catch (...) { }

    schedule ();
  }
Пример #5
0
   virtual bool operator== (const action_executor_interface& x) const {
     return
 	get_aid () == x.get_aid () &&
 	get_member_ptr () == x.get_member_ptr () &&
 	get_pid () == x.get_pid ();
   }