Skip to content
This repository was archived by the owner on May 28, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace common {
static const int kDebugCheckTime = 5000;

// An unscalable thread pool implimention.
class ThreadPool {
class ThreadPoolCpp11 {
public:
ThreadPool(int thread_num = 10)
ThreadPoolCpp11(int thread_num = 10)
: threads_num_(thread_num),
pending_num_(0),
work_cv_(&mutex_),
Expand All @@ -38,7 +38,7 @@ class ThreadPool {
task_count_(0) {
Start();
}
~ThreadPool() {
~ThreadPoolCpp11() {
Stop(false);
}
// Start a thread_num threads pool.
Expand Down Expand Up @@ -174,11 +174,11 @@ class ThreadPool {
}

private:
ThreadPool(const ThreadPool&);
void operator=(const ThreadPool&);
ThreadPoolCpp11(const ThreadPoolCpp11&);
void operator=(const ThreadPoolCpp11&);

static void* ThreadWrapper(void* arg) {
reinterpret_cast<ThreadPool*>(arg)->ThreadProc();
reinterpret_cast<ThreadPoolCpp11*>(arg)->ThreadProc();
return NULL;
}
void ThreadProc() {
Expand Down Expand Up @@ -279,7 +279,7 @@ class ThreadPool {

} // namespace common

using common::ThreadPool;
using common::ThreadPoolCpp11;

} // namespace baidu

Expand Down