本文整理汇总了C++中static_hashed_set::count_nodes方法的典型用法代码示例。如果您正苦于以下问题:C++ static_hashed_set::count_nodes方法的具体用法?C++ static_hashed_set::count_nodes怎么用?C++ static_hashed_set::count_nodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static_hashed_set
的用法示例。
在下文中一共展示了static_hashed_set::count_nodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run(void)
{
BOOST_WARN(stk.is_lock_free());
running.store(true);
thread_group writer;
thread_group reader;
BOOST_REQUIRE(stk.empty());
for (int i = 0; i != reader_threads; ++i)
reader.create_thread(boost::bind(&stack_tester::get_items, this));
for (int i = 0; i != writer_threads; ++i)
writer.create_thread(boost::bind(&stack_tester::add_items, this));
using namespace std;
cout << "threads created" << endl;
writer.join_all();
cout << "writer threads joined, waiting for readers" << endl;
running = false;
reader.join_all();
cout << "reader threads joined" << endl;
BOOST_REQUIRE_EQUAL(data.count_nodes(), 0);
BOOST_REQUIRE(stk.empty());
BOOST_REQUIRE_EQUAL(push_count, pop_count);
BOOST_REQUIRE_EQUAL(push_count, writer_threads * node_count);
}
示例2: run
void run(void)
{
running = true;
thread_group writer;
thread_group reader;
BOOST_REQUIRE(sf.empty());
for (int i = 0; i != reader_threads; ++i)
reader.create_thread(boost::bind(&fifo_tester::get, this));
for (int i = 0; i != writer_threads; ++i)
writer.create_thread(boost::bind(&fifo_tester::add, this));
cout << "reader and writer threads created" << endl;
writer.join_all();
cout << "writer threads joined. waiting for readers to finish" << endl;
running = false;
reader.join_all();
BOOST_REQUIRE_EQUAL(received_nodes, writer_threads * nodes_per_thread);
BOOST_REQUIRE_EQUAL(fifo_cnt, 0);
BOOST_REQUIRE(sf.empty());
BOOST_REQUIRE(working_set.count_nodes() == 0);
}