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