19a1e991dSShuo Chen// excerpts from http://code.google.com/p/muduo/ 29a1e991dSShuo Chen// 39a1e991dSShuo Chen// Use of this source code is governed by a BSD-style license 49a1e991dSShuo Chen// that can be found in the License file. 59a1e991dSShuo Chen// 69a1e991dSShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 79a1e991dSShuo Chen 89a1e991dSShuo Chen#ifndef MUDUO_NET_EVENTLOOPTHREAD_H 99a1e991dSShuo Chen#define MUDUO_NET_EVENTLOOPTHREAD_H 109a1e991dSShuo Chen 119a1e991dSShuo Chen#include "thread/Condition.h" 129a1e991dSShuo Chen#include "thread/Mutex.h" 139a1e991dSShuo Chen#include "thread/Thread.h" 149a1e991dSShuo Chen 159a1e991dSShuo Chen#include <boost/noncopyable.hpp> 169a1e991dSShuo Chen 179a1e991dSShuo Chennamespace muduo 189a1e991dSShuo Chen{ 199a1e991dSShuo Chen 209a1e991dSShuo Chenclass EventLoop; 219a1e991dSShuo Chen 229a1e991dSShuo Chenclass EventLoopThread : boost::noncopyable 239a1e991dSShuo Chen{ 249a1e991dSShuo Chen public: 259a1e991dSShuo Chen EventLoopThread(); 269a1e991dSShuo Chen ~EventLoopThread(); 279a1e991dSShuo Chen EventLoop* startLoop(); 289a1e991dSShuo Chen 299a1e991dSShuo Chen private: 309a1e991dSShuo Chen void threadFunc(); 319a1e991dSShuo Chen 329a1e991dSShuo Chen EventLoop* loop_; 339a1e991dSShuo Chen bool exiting_; 349a1e991dSShuo Chen Thread thread_; 359a1e991dSShuo Chen MutexLock mutex_; 369a1e991dSShuo Chen Condition cond_; 379a1e991dSShuo Chen}; 389a1e991dSShuo Chen 399a1e991dSShuo Chen} 409a1e991dSShuo Chen 419a1e991dSShuo Chen#endif // MUDUO_NET_EVENTLOOPTHREAD_H 429a1e991dSShuo Chen 43