本文整理汇总了C++中FreeList::getDebug方法的典型用法代码示例。如果您正苦于以下问题:C++ FreeList::getDebug方法的具体用法?C++ FreeList::getDebug怎么用?C++ FreeList::getDebug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreeList
的用法示例。
在下文中一共展示了FreeList::getDebug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: threadFunc
void threadFunc(FreeList& pool, ros::atomic<bool>& done, ros::atomic<bool>& failed, boost::barrier& b)
{
b.wait();
//ROS_INFO_STREAM("Thread " << boost::this_thread::get_id() << " starting");
uint32_t* vals[10];
uint64_t alloc_count = 0;
while (!done.load())
{
for (uint32_t i = 0; i < 10; ++i)
{
vals[i] = static_cast<uint32_t*>(pool.allocate());
if (vals[i])
{
++alloc_count;
*vals[i] = i;
}
else
{
ROS_ERROR_STREAM("Thread " << boost::this_thread::get_id() << " failed to allocate");
}
}
for (uint32_t i = 0; i < 10; ++i)
{
if (vals[i])
{
if (*vals[i] != i)
{
ROS_ERROR_STREAM("Thread " << boost::this_thread::get_id() << " val " << vals[i] << " " << i << " = " << *vals[i]);
failed.store(true);
}
pool.free(vals[i]);
}
}
if (failed.load())
{
#if FREE_LIST_DEBUG
boost::mutex::scoped_lock lock(g_debug_mutex);
g_debug.push_back(*pool.getDebug());
#endif
return;
}
}
//ROS_INFO_STREAM("Thread " << boost::this_thread::get_id() << " allocated " << alloc_count << " blocks");
}