使用 boost::thread boost::test

另一个文件使用 boost::thread  boost::test 

#include < boost/test/auto_unit_test.hpp >
#include < boost/thread/thread.hpp >
#include < boost/bind.hpp >
#include < windows.h >
#include < iostream >
int count = 0;
boost::mutex mutex;
void increment_count(int i, int j)
{
boost::mutex::scoped_lock lock(mutex);
count++;
Sleep(30);
std::cout << "count = " << count << " i= " <

}

BOOST_AUTO_TEST_CASE( thread )
{
boost::thread_group threads;
for (int i = 0; i < 10; ++i)
threads.create_thread(
boost::bind(&increment_count,i,i+1));
threads.join_all();
}

2 Comments »

  1. 化石 said,

    March 12, 2007 @ 11:01

    兄弟,你的桌面搜索用的是自已开发的引擎,还是用的clucene.
    另外,你可以开发出网游的验证字符的识别系统吗

  2. wx said,

    July 1, 2007 @ 10:25

    请联系我,谢谢!

RSS feed for comments on this post

发表评论


0.013 sec