1354280cfSShuo Chen// excerpts from http://code.google.com/p/muduo/ 2354280cfSShuo Chen// 3354280cfSShuo Chen// Use of this source code is governed by a BSD-style license 4354280cfSShuo Chen// that can be found in the License file. 5354280cfSShuo Chen// 6354280cfSShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 7354280cfSShuo Chen 8354280cfSShuo Chen#ifndef MUDUO_NET_EVENTLOOPTHREAD_H 9354280cfSShuo Chen#define MUDUO_NET_EVENTLOOPTHREAD_H 10354280cfSShuo Chen 11354280cfSShuo Chen#include "thread/Condition.h" 12354280cfSShuo Chen#include "thread/Mutex.h" 13354280cfSShuo Chen#include "thread/Thread.h" 14354280cfSShuo Chen 15354280cfSShuo Chen#include <boost/noncopyable.hpp> 16354280cfSShuo Chen 17354280cfSShuo Chennamespace muduo 18354280cfSShuo Chen{ 19354280cfSShuo Chen 20354280cfSShuo Chenclass EventLoop; 21354280cfSShuo Chen 22354280cfSShuo Chenclass EventLoopThread : boost::noncopyable 23354280cfSShuo Chen{ 24354280cfSShuo Chen public: 25354280cfSShuo Chen EventLoopThread(); 26354280cfSShuo Chen ~EventLoopThread(); 27354280cfSShuo Chen EventLoop* startLoop(); 28354280cfSShuo Chen 29354280cfSShuo Chen private: 30354280cfSShuo Chen void threadFunc(); 31354280cfSShuo Chen 32354280cfSShuo Chen EventLoop* loop_; 33354280cfSShuo Chen bool exiting_; 34354280cfSShuo Chen Thread thread_; 35354280cfSShuo Chen MutexLock mutex_; 36354280cfSShuo Chen Condition cond_; 37354280cfSShuo Chen}; 38354280cfSShuo Chen 39354280cfSShuo Chen} 40354280cfSShuo Chen 41354280cfSShuo Chen#endif // MUDUO_NET_EVENTLOOPTHREAD_H 42354280cfSShuo Chen 43