EventLoopThread.h revision 65c497a3
165c497a3SShuo Chen// excerpts from http://code.google.com/p/muduo/ 265c497a3SShuo Chen// 365c497a3SShuo Chen// Use of this source code is governed by a BSD-style license 465c497a3SShuo Chen// that can be found in the License file. 565c497a3SShuo Chen// 665c497a3SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 765c497a3SShuo Chen 865c497a3SShuo Chen#ifndef MUDUO_NET_EVENTLOOPTHREAD_H 965c497a3SShuo Chen#define MUDUO_NET_EVENTLOOPTHREAD_H 1065c497a3SShuo Chen 1165c497a3SShuo Chen#include "thread/Condition.h" 1265c497a3SShuo Chen#include "thread/Mutex.h" 1365c497a3SShuo Chen#include "thread/Thread.h" 1465c497a3SShuo Chen 1565c497a3SShuo Chen#include <boost/noncopyable.hpp> 1665c497a3SShuo Chen 1765c497a3SShuo Chennamespace muduo 1865c497a3SShuo Chen{ 1965c497a3SShuo Chen 2065c497a3SShuo Chenclass EventLoop; 2165c497a3SShuo Chen 2265c497a3SShuo Chenclass EventLoopThread : boost::noncopyable 2365c497a3SShuo Chen{ 2465c497a3SShuo Chen public: 2565c497a3SShuo Chen EventLoopThread(); 2665c497a3SShuo Chen ~EventLoopThread(); 2765c497a3SShuo Chen EventLoop* startLoop(); 2865c497a3SShuo Chen 2965c497a3SShuo Chen private: 3065c497a3SShuo Chen void threadFunc(); 3165c497a3SShuo Chen 3265c497a3SShuo Chen EventLoop* loop_; 3365c497a3SShuo Chen bool exiting_; 3465c497a3SShuo Chen Thread thread_; 3565c497a3SShuo Chen MutexLock mutex_; 3665c497a3SShuo Chen Condition cond_; 3765c497a3SShuo Chen}; 3865c497a3SShuo Chen 3965c497a3SShuo Chen} 4065c497a3SShuo Chen 4165c497a3SShuo Chen#endif // MUDUO_NET_EVENTLOOPTHREAD_H 4265c497a3SShuo Chen 43