コード例 #1
0
ファイル: sender.hpp プロジェクト: 7ev3n/hpx
        void send_messages(
            connection_list connections
        )
        {
            // We try to handle all sends
            connection_list::iterator end = std::remove_if(
                connections.begin()
              , connections.end()
              , [](connection_ptr sender) -> bool
              {
                    if(sender->send())
                    {
                        error_code ec;
                        sender->postprocess_handler_(ec, sender->destination(), sender);
                        return true;
                    }
                    return false;
              }
            );

            // If some are still in progress, give them back
            if(connections.begin() != end)
            {
                std::unique_lock<mutex_type> l(connections_mtx_);
                connections_.insert(
                    connections_.end()
                  , std::make_move_iterator(connections.begin())
                  , std::make_move_iterator(end)
                );
            }
        }
コード例 #2
0
ファイル: receiver.hpp プロジェクト: devangb/hpx
        void receive_messages(
            connection_list connections
        )
        {
            // We try to handle all receives
            connection_list::iterator end = std::remove_if(
                connections.begin()
              , connections.end()
              , [](connection_ptr & rcv) -> bool
              {
                    return rcv->receive();
              }
            );

            // If some are still in progress, give them back
            if(connections.begin() != end)
            {
                boost::unique_lock<mutex_type> l(connections_mtx_);
                connections_.insert(
                    connections_.end()
                  , std::make_move_iterator(connections.begin())
                  , std::make_move_iterator(end)
                );
            }
        }