// excerpts from http://code.google.com/p/muduo/ // // Use of this source code is governed by a BSD-style license // that can be found in the License file. // // Author: Shuo Chen (chenshuo at chenshuo dot com) #ifndef MUDUO_NET_EVENTLOOPTHREADPOOL_H #define MUDUO_NET_EVENTLOOPTHREADPOOL_H #include "thread/Condition.h" #include "thread/Mutex.h" #include "thread/Thread.h" #include #include #include #include namespace muduo { class EventLoop; class EventLoopThread; class EventLoopThreadPool : boost::noncopyable { public: EventLoopThreadPool(EventLoop* baseLoop); ~EventLoopThreadPool(); void setThreadNum(int numThreads) { numThreads_ = numThreads; } void start(); EventLoop* getNextLoop(); private: EventLoop* baseLoop_; bool started_; int numThreads_; int next_; // always in loop thread boost::ptr_vector threads_; std::vector loops_; }; } #endif // MUDUO_NET_EVENTLOOPTHREADPOOL_H