当前位置: 首页>>代码示例>>C++>>正文


C++ threadpool::service方法代码示例

本文整理汇总了C++中threadpool::service方法的典型用法代码示例。如果您正苦于以下问题:C++ threadpool::service方法的具体用法?C++ threadpool::service怎么用?C++ threadpool::service使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在threadpool的用法示例。


在下文中一共展示了threadpool::service方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

channel_proxy::channel_proxy(threadpool& pool, socket_ptr socket)
  : strand_(pool),
    socket_(socket),
    timeout_(pool.service()),
    heartbeat_(pool.service()),
    revival_(pool.service()),
    revival_handler_(nullptr),
    stopped_(false),
    raw_subscriber_(std::make_shared<raw_subscriber_type>(pool)),
    stop_subscriber_(std::make_shared<stop_subscriber_type>(pool))
{
#define CHANNEL_TRANSPORT_MECHANISM(MESSAGE_TYPE) \
    MESSAGE_TYPE##_subscriber_ = \
        std::make_shared<MESSAGE_TYPE##_subscriber_type>(pool); \
    loader_.add(new channel_loader_module<MESSAGE_TYPE##_type>( \
        std::bind(&MESSAGE_TYPE##_subscriber_type::relay, \
            MESSAGE_TYPE##_subscriber_, _1, _2)));

    CHANNEL_TRANSPORT_MECHANISM(version);
    CHANNEL_TRANSPORT_MECHANISM(verack);
    CHANNEL_TRANSPORT_MECHANISM(address);
    CHANNEL_TRANSPORT_MECHANISM(get_address);
    CHANNEL_TRANSPORT_MECHANISM(inventory);
    CHANNEL_TRANSPORT_MECHANISM(get_data);
    CHANNEL_TRANSPORT_MECHANISM(get_blocks);
    CHANNEL_TRANSPORT_MECHANISM(transaction);
    CHANNEL_TRANSPORT_MECHANISM(block);

#undef CHANNEL_TRANSPORT_MECHANISM
}
开发者ID:kleetus,项目名称:libbitcoin,代码行数:30,代码来源:channel_proxy.cpp

示例2:

connector::connector(threadpool& pool, const settings& settings)
  : pool_(pool),
    settings_(settings),
    resolver_(std::make_shared<asio::resolver>(pool.service())),
    CONSTRUCT_TRACK(connector, LOG_NETWORK)
{
}
开发者ID:zauguin,项目名称:libbitcoin,代码行数:7,代码来源:connector.cpp

示例3:

protocol::protocol(threadpool& pool, hosts& hsts,
                   handshake& shake, network& net)
    : strand_(pool), hosts_(hsts), handshake_(shake), network_(net),
      watermark_timer_(pool.service())
{
    channel_subscribe_ = std::make_shared<channel_subscriber_type>(pool);
}
开发者ID:kaostao,项目名称:libbitcoin,代码行数:7,代码来源:protocol.cpp

示例4:

session::session(threadpool& pool, const session_params& params)
  : strand_(pool.service()),
    handshake_(params.handshake_), protocol_(params.protocol_),
    chain_(params.blockchain_), poll_(params.poller_),
    tx_pool_(params.transaction_pool_),
    grabbed_invs_(20)
{
}
开发者ID:hellais,项目名称:libbitcoin,代码行数:8,代码来源:session.cpp

示例5:

connector::connector(threadpool& pool, const settings& settings)
  : stopped_(false),
    pool_(pool),
    settings_(settings),
    pending_(settings_),
    dispatch_(pool, NAME),
    resolver_(std::make_shared<asio::resolver>(pool.service())),
    CONSTRUCT_TRACK(connector)
{
}
开发者ID:libbitcoin,项目名称:libbitcoin-network,代码行数:10,代码来源:connector.cpp

示例6:

work::work(threadpool& pool, const std::string& name)
  : name_(name),
    ////ordered_(std::make_shared<monitor::count>(0)),
    ////unordered_(std::make_shared<monitor::count>(0)),
    ////concurrent_(std::make_shared<monitor::count>(0)),
    ////sequential_(std::make_shared<monitor::count>(0)),
    service_(pool.service()),
    strand_(service_),
    sequence_(service_)
{
}
开发者ID:RojavaCrypto,项目名称:libbitcoin,代码行数:11,代码来源:work.cpp

示例7:

blockchain_impl::blockchain_impl(threadpool& pool, const std::string& prefix,
    const db_active_heights &active_heights, size_t orphan_capacity)
  : ios_(pool.service()), write_strand_(pool), reorg_strand_(pool),
    flock_(init_lock(prefix)), seqlock_(0), stopped_(false), db_paths_(prefix),
    interface_(db_paths_, active_heights), orphans_(orphan_capacity),
    chain_(simple_chain_impl(interface_)),
    reorganize_subscriber_(std::make_shared<reorganize_subscriber_type>(pool)),
    organizer_(organizer_factory(reorg_strand_, interface_, orphans_, chain_,
        reorganize_subscriber_))
{
}
开发者ID:libmetrocoin,项目名称:libmetrocoin-blockchain,代码行数:11,代码来源:blockchain_impl.cpp

示例8: rand

handshake::handshake(threadpool& pool)
  : strand_(pool.service())
{
    // Setup template version packet with defaults
    template_version_.version = protocol_version;
    template_version_.services = 1;
    // non-constant field
    //template_version_.timestamp = time(NULL);
    template_version_.address_me.services = template_version_.services;
    template_version_.address_me.ip = localhost_ip();
    template_version_.address_me.port = protocol_port;
    template_version_.address_you.services = template_version_.services;
    template_version_.address_you.ip =
        ip_address_type{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01}};
    template_version_.address_you.port = protocol_port;
    template_version_.user_agent = "/libbitcoin:" LIBBITCOIN_VERSION "/";
    template_version_.start_height = 0;
    template_version_.nonce = rand();
}
开发者ID:Mrkebubun,项目名称:libbitcoin,代码行数:20,代码来源:handshake.cpp

示例9: rand

		handshake::handshake(threadpool& pool, p2p_network p2p)
			: strand_(pool.service()), p2p_(p2p)
		{
			// Setup template version packet with defaults
			template_version_.version = protocol_version;
			template_version_.services = 1;
			// non-constant field
			//template_version_.timestamp = time(NULL);
			template_version_.address_me.services = template_version_.services;
			template_version_.address_me.ip = localhost_ip();
			template_version_.address_me.port = p2p_.get_port();
			template_version_.address_you.services = template_version_.services;
			template_version_.address_you.ip =
				ip_address_type{ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
				0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01 } };
			template_version_.address_you.port = p2p_.get_port();
			template_version_.user_agent = "/decentralised:" DC_CORE_LIB_VERSION "/";
			template_version_.start_height = 0;
			template_version_.nonce = rand();
		}
开发者ID:ballisticwhisper,项目名称:decentralised,代码行数:20,代码来源:handshake.cpp

示例10:

async_strand::async_strand(threadpool& pool)
  : ios_(pool.service()), strand_(ios_)
{
}
开发者ID:hsk81,项目名称:libbitcoin,代码行数:4,代码来源:threadpool.cpp

示例11:

leveldb_blockchain::leveldb_blockchain(threadpool& pool)
  : ios_(pool.service()), strand_(pool), reorg_strand_(pool), seqlock_(0)
{
    reorganize_subscriber_ =
        std::make_shared<reorganize_subscriber_type>(pool);
}
开发者ID:favioflamingo,项目名称:libbitcoin,代码行数:6,代码来源:leveldb_blockchain.cpp

示例12:

// This protects timer_ against concurrent access with no chance of deadlock.
// This can be dereferenced with an outstanding callback because the timer
// closure captures an instance of this class and the callback.
// This is guaranteed to call handler exactly once unless canceled or reset.
deadline::deadline(threadpool& pool, const asio::duration duration)
  : duration_(duration),
    timer_(pool.service()),
    CONSTRUCT_TRACK(deadline)
{
}
开发者ID:bankonca,项目名称:libbitcoin,代码行数:10,代码来源:deadline.cpp

示例13: subscriber

 subscriber(threadpool& pool)
   : strand_(pool.service())
 {
 }
开发者ID:bitkevin,项目名称:libbitcoin,代码行数:4,代码来源:subscriber.hpp

示例14:

poller::poller(threadpool& pool, blockchain& chain)
    : strand_(pool.service()), chain_(chain),
      last_locator_begin_(null_hash), last_hash_stop_(null_hash),
      last_block_hash_(null_hash)
{
}
开发者ID:standardcrypto,项目名称:libbitcoin,代码行数:6,代码来源:poller.cpp

示例15:

 perform_connect_with_timeout(threadpool& pool)
   : timer_(pool.service())
 {
     socket_ = std::make_shared<tcp::socket>(pool.service());
     proxy_ = std::make_shared<channel_proxy>(pool, socket_);
 }
开发者ID:kaostao,项目名称:libbitcoin,代码行数:6,代码来源:network.cpp


注:本文中的threadpool::service方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。