1c461658bSShuo Chen// excerpts from http://code.google.com/p/muduo/ 2c461658bSShuo Chen// 3c461658bSShuo Chen// Use of this source code is governed by a BSD-style license 4c461658bSShuo Chen// that can be found in the License file. 5c461658bSShuo Chen// 6c461658bSShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 7c461658bSShuo Chen 8c461658bSShuo Chen#ifndef MUDUO_NET_EVENTLOOPTHREAD_H 9c461658bSShuo Chen#define MUDUO_NET_EVENTLOOPTHREAD_H 10c461658bSShuo Chen 11c461658bSShuo Chen#include "thread/Condition.h" 12c461658bSShuo Chen#include "thread/Mutex.h" 13c461658bSShuo Chen#include "thread/Thread.h" 14c461658bSShuo Chen 15c461658bSShuo Chen#include <boost/noncopyable.hpp> 16c461658bSShuo Chen 17c461658bSShuo Chennamespace muduo 18c461658bSShuo Chen{ 19c461658bSShuo Chen 20c461658bSShuo Chenclass EventLoop; 21c461658bSShuo Chen 22c461658bSShuo Chenclass EventLoopThread : boost::noncopyable 23c461658bSShuo Chen{ 24c461658bSShuo Chen public: 25c461658bSShuo Chen EventLoopThread(); 26c461658bSShuo Chen ~EventLoopThread(); 27c461658bSShuo Chen EventLoop* startLoop(); 28c461658bSShuo Chen 29c461658bSShuo Chen private: 30c461658bSShuo Chen void threadFunc(); 31c461658bSShuo Chen 32c461658bSShuo Chen EventLoop* loop_; 33c461658bSShuo Chen bool exiting_; 34c461658bSShuo Chen Thread thread_; 35c461658bSShuo Chen MutexLock mutex_; 36c461658bSShuo Chen Condition cond_; 37c461658bSShuo Chen}; 38c461658bSShuo Chen 39c461658bSShuo Chen} 40c461658bSShuo Chen 41c461658bSShuo Chen#endif // MUDUO_NET_EVENTLOOPTHREAD_H 42c461658bSShuo Chen 43