Skip to content

Commit 64e7688

Browse files
committed
clean more APIs
test=develop
1 parent c891bc2 commit 64e7688

File tree

3 files changed

+0
-13
lines changed

3 files changed

+0
-13
lines changed

paddle/fluid/framework/threadpool.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,14 @@ DEFINE_int32(dist_threadpool_size, 0,
2525

2626
namespace paddle {
2727
namespace framework {
28-
std::mutex threadpool_mu;
2928
std::unique_ptr<ThreadPool> ThreadPool::threadpool_(nullptr);
3029
std::once_flag ThreadPool::init_flag_;
3130

3231
ThreadPool* ThreadPool::GetInstance() {
33-
std::lock_guard<std::mutex> l(threadpool_mu);
3432
std::call_once(init_flag_, &ThreadPool::Init);
3533
return threadpool_.get();
3634
}
3735

38-
void ThreadPool::TestReset() {
39-
std::lock_guard<std::mutex> l(threadpool_mu);
40-
threadpool_.reset(nullptr);
41-
ThreadPool::Init();
42-
}
43-
4436
void ThreadPool::Init() {
4537
if (threadpool_.get() == nullptr) {
4638
// TODO(Yancey1989): specify the max threads number

paddle/fluid/framework/threadpool.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ class ThreadPool {
5555
// Returns the singleton of ThreadPool.
5656
static ThreadPool* GetInstance();
5757

58-
// delete current thread pool and create a new one.
59-
// Only used by test cases to reset the threadpool.
60-
static void TestReset();
61-
6258
~ThreadPool();
6359

6460
// Run pushes a function to the task queue and returns a std::future

paddle/fluid/framework/threadpool_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,5 @@ TEST(ThreadPool, ConcurrentRun) {
5252
for (auto& t : threads) {
5353
t.join();
5454
}
55-
framework::ThreadPool::TestReset();
5655
EXPECT_EQ(sum, ((n + 1) * n) / 2);
5756
}

0 commit comments

Comments
 (0)