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