EventLoopThread.h revision 40161064
140161064SShuo Chen// excerpts from http://code.google.com/p/muduo/
240161064SShuo Chen//
340161064SShuo Chen// Use of this source code is governed by a BSD-style license
440161064SShuo Chen// that can be found in the License file.
540161064SShuo Chen//
640161064SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com)
740161064SShuo Chen
840161064SShuo Chen#ifndef MUDUO_NET_EVENTLOOPTHREAD_H
940161064SShuo Chen#define MUDUO_NET_EVENTLOOPTHREAD_H
1040161064SShuo Chen
1140161064SShuo Chen#include "thread/Condition.h"
1240161064SShuo Chen#include "thread/Mutex.h"
1340161064SShuo Chen#include "thread/Thread.h"
1440161064SShuo Chen
1540161064SShuo Chen#include <boost/noncopyable.hpp>
1640161064SShuo Chen
1740161064SShuo Chennamespace muduo
1840161064SShuo Chen{
1940161064SShuo Chen
2040161064SShuo Chenclass EventLoop;
2140161064SShuo Chen
2240161064SShuo Chenclass EventLoopThread : boost::noncopyable
2340161064SShuo Chen{
2440161064SShuo Chen public:
2540161064SShuo Chen  EventLoopThread();
2640161064SShuo Chen  ~EventLoopThread();
2740161064SShuo Chen  EventLoop* startLoop();
2840161064SShuo Chen
2940161064SShuo Chen private:
3040161064SShuo Chen  void threadFunc();
3140161064SShuo Chen
3240161064SShuo Chen  EventLoop* loop_;
3340161064SShuo Chen  bool exiting_;
3440161064SShuo Chen  Thread thread_;
3540161064SShuo Chen  MutexLock mutex_;
3640161064SShuo Chen  Condition cond_;
3740161064SShuo Chen};
3840161064SShuo Chen
3940161064SShuo Chen}
4040161064SShuo Chen
4140161064SShuo Chen#endif  // MUDUO_NET_EVENTLOOPTHREAD_H
4240161064SShuo Chen
43