本文整理汇总了C++中request::get_count方法的典型用法代码示例。如果您正苦于以下问题:C++ request::get_count方法的具体用法?C++ request::get_count怎么用?C++ request::get_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::get_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocate
response locality_namespace::allocate(
request const& req
, error_code& ec
)
{ // {{{ allocate implementation
using hpx::util::get;
// parameters
parcelset::endpoints_type endpoints = req.get_endpoints();
boost::uint64_t const count = req.get_count();
boost::uint32_t const num_threads = req.get_num_threads();
naming::gid_type const suggested_prefix = req.get_suggested_prefix();
std::unique_lock<mutex_type> l(mutex_);
#if defined(HPX_DEBUG)
for (partition_table_type::value_type const& partition : partitions_)
{
HPX_ASSERT(get<0>(partition.second) != endpoints);
}
#endif
// Check for address space exhaustion.
if (HPX_UNLIKELY(0xFFFFFFFE < partitions_.size())) //-V104
{
l.unlock();
HPX_THROWS_IF(ec, internal_server_error
, "locality_namespace::allocate"
, "primary namespace has been exhausted");
return response();
}
// Compute the locality's prefix.
boost::uint32_t prefix = naming::invalid_locality_id;
// check if the suggested prefix can be used instead of the next
// free one
boost::uint32_t suggested_locality_id =
naming::get_locality_id_from_gid(suggested_prefix);
partition_table_type::iterator it = partitions_.end();
if (suggested_locality_id != naming::invalid_locality_id)
{
it = partitions_.find(suggested_locality_id);
if(it == partitions_.end())
{
prefix = suggested_locality_id;
}
else
{
do {
prefix = prefix_counter_++;
it = partitions_.find(prefix);
} while (it != partitions_.end());
}
}
else
{
do {
prefix = prefix_counter_++;
it = partitions_.find(prefix);
} while (it != partitions_.end());
}
// We need to create an entry in the partition table for this
// locality.
if(HPX_UNLIKELY(!util::insert_checked(partitions_.insert(
std::make_pair(prefix, partition_type(endpoints, num_threads))), it)))
{
l.unlock();
HPX_THROWS_IF(ec, lock_error
, "locality_namespace::allocate"
, boost::str(boost::format(
"partition table insertion failed due to a locking "
"error or memory corruption, endpoint(%1%), "
"prefix(%2%)") % endpoints % prefix));
return response();
}
// Now that we've inserted the locality into the partition table
// successfully, we need to put the locality's GID into the GVA
// table so that parcels can be sent to the memory of a locality.
if (primary_)
{
naming::gid_type id(naming::get_gid_from_locality_id(prefix));
gva const g(id, components::component_runtime_support, count);
request req(primary_ns_bind_gid, id, g, id);
response resp = primary_->service(req, ec);
if (ec) return resp;
}
LAGAS_(info) << (boost::format(
"locality_namespace::allocate, ep(%1%), count(%2%), "
"prefix(%3%)")
% endpoints % count % prefix);
//.........这里部分代码省略.........