19807252eSShuo Chen#include "EventLoop.h" 29807252eSShuo Chen#include "EventLoopThread.h" 39807252eSShuo Chen#include <stdio.h> 49807252eSShuo Chen 59807252eSShuo Chenvoid runInThread() 69807252eSShuo Chen{ 7a20e676dSShuo Chen printf("runInThread(): pid = %d, tid = %d\n", 8a20e676dSShuo Chen getpid(), muduo::CurrentThread::tid()); 99807252eSShuo Chen} 109807252eSShuo Chen 119807252eSShuo Chenint main() 129807252eSShuo Chen{ 13a20e676dSShuo Chen printf("main(): pid = %d, tid = %d\n", 14a20e676dSShuo Chen getpid(), muduo::CurrentThread::tid()); 159807252eSShuo Chen 169807252eSShuo Chen muduo::EventLoopThread loopThread; 179807252eSShuo Chen muduo::EventLoop* loop = loopThread.startLoop(); 189807252eSShuo Chen loop->runInLoop(runInThread); 199807252eSShuo Chen sleep(1); 209807252eSShuo Chen loop->runAfter(2, runInThread); 219807252eSShuo Chen sleep(3); 229807252eSShuo Chen loop->quit(); 239807252eSShuo Chen 249807252eSShuo Chen printf("exit main().\n"); 259807252eSShuo Chen} 26