tanghai пре 15 година
родитељ
комит
3168b7cc16
3 измењених фајлова са 17 додато и 11 уклоњено
  1. 1 0
      .gitignore
  2. 10 5
      SConstruct
  3. 6 6
      src/thread/thread_pool_test.cc

+ 1 - 0
.gitignore

@@ -4,5 +4,6 @@
 
 .sconsign.dblite
 
+.settings/
 dbg/
 opt/

+ 10 - 5
SConstruct

@@ -9,6 +9,10 @@ def ParseOptions():
 
 ParseOptions()
 
+env.Append(LIBPATH=[
+	'/usr/local/lib'
+])
+
 env.Append(LIBS=[
 	'gflags',
 	'glog',
@@ -18,16 +22,17 @@ env.Append(LIBS=[
 
 if GetOption('opt') == True:
 	env['root'] = 'opt'
-	env.Append(CCFLAGS='-g')
-	env.Append(LIBS='tcmalloc_debug')
-else:
-	env['root'] = 'dbg'
 	env.Append(CCFLAGS='-O2 -g')
 	env.Append(LIBS='tcmalloc')
+else:
+	env['root'] = 'dbg'
+	env.Append(CCFLAGS='-g')
+	env.Append(LIBS='tcmalloc_debug')
 
 env.Append(CPPPATH=Dir(env['root']).abspath)
 
+
 Export('env')
 
-SConscript('src/SConscript', build_dir=env['root'])
+SConscript('src/SConscript', variant_dir=env['root'])
 

+ 6 - 6
src/thread/thread_pool_test.cc

@@ -11,17 +11,17 @@ class ThreadPoolTest: public testing::Test
 {
 	void SetUp()
 	{
-		thread_pool.set_num(10);
-		thread_pool.start();
+		pool.set_num(10);
+		pool.start();
 	}
 	void TearDown()
 	{
 	}
 protected:
-	thread_pool thread_pool;
+	thread_pool pool;
 public:
 	ThreadPoolTest() :
-		thread_pool()
+		pool()
 	{
 	}
 	void Max(int a, int b, int* z)
@@ -37,10 +37,10 @@ TEST_F(ThreadPoolTest, Test1)
 	vector<int> z(100, 0);
 	for (int i = 0; i < 100; ++i)
 	{
-		thread_pool.push_task(
+		pool.push_task(
 				bind(&ThreadPoolTest::Max, this, x[i], y[i], &z[i]));
 	}
-	thread_pool.stop();
+	pool.stop();
 	for (int i = 0; i < 100; ++i)
 	{
 		ASSERT_EQ(9, z[i])<< "i = " << i;