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