本文整理汇总了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
}
示例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)
{
}
示例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);
}
示例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)
{
}
示例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)
{
}
示例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_)
{
}
示例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_))
{
}
示例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();
}
示例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();
}
示例10:
async_strand::async_strand(threadpool& pool)
: ios_(pool.service()), strand_(ios_)
{
}
示例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);
}
示例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)
{
}
示例13: subscriber
subscriber(threadpool& pool)
: strand_(pool.service())
{
}
示例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)
{
}
示例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_);
}