12a18e699SShuo Chen#include "EventLoop.h" 22a18e699SShuo Chen#include "EventLoopThread.h" 32a18e699SShuo Chen#include <stdio.h> 42a18e699SShuo Chen 52a18e699SShuo Chenvoid runInThread() 62a18e699SShuo Chen{ 72a18e699SShuo Chen printf("runInThread(): pid = %d, tid = %d\n", 82a18e699SShuo Chen getpid(), muduo::CurrentThread::tid()); 92a18e699SShuo Chen} 102a18e699SShuo Chen 112a18e699SShuo Chenint main() 122a18e699SShuo Chen{ 132a18e699SShuo Chen printf("main(): pid = %d, tid = %d\n", 142a18e699SShuo Chen getpid(), muduo::CurrentThread::tid()); 152a18e699SShuo Chen 162a18e699SShuo Chen muduo::EventLoopThread loopThread; 172a18e699SShuo Chen muduo::EventLoop* loop = loopThread.startLoop(); 182a18e699SShuo Chen loop->runInLoop(runInThread); 192a18e699SShuo Chen sleep(1); 202a18e699SShuo Chen loop->runAfter(2, runInThread); 212a18e699SShuo Chen sleep(3); 222a18e699SShuo Chen loop->quit(); 232a18e699SShuo Chen 242a18e699SShuo Chen printf("exit main().\n"); 252a18e699SShuo Chen} 26