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