165c497a3SShuo Chen#include "EventLoop.h" 265c497a3SShuo Chen#include "EventLoopThread.h" 365c497a3SShuo Chen#include <stdio.h> 465c497a3SShuo Chen 565c497a3SShuo Chenvoid runInThread() 665c497a3SShuo Chen{ 765c497a3SShuo Chen printf("runInThread(): pid = %d, tid = %d\n", 865c497a3SShuo Chen getpid(), muduo::CurrentThread::tid()); 965c497a3SShuo Chen} 1065c497a3SShuo Chen 1165c497a3SShuo Chenint main() 1265c497a3SShuo Chen{ 1365c497a3SShuo Chen printf("main(): pid = %d, tid = %d\n", 1465c497a3SShuo Chen getpid(), muduo::CurrentThread::tid()); 1565c497a3SShuo Chen 1665c497a3SShuo Chen muduo::EventLoopThread loopThread; 1765c497a3SShuo Chen muduo::EventLoop* loop = loopThread.startLoop(); 1865c497a3SShuo Chen loop->runInLoop(runInThread); 1965c497a3SShuo Chen sleep(1); 2065c497a3SShuo Chen loop->runAfter(2, runInThread); 2165c497a3SShuo Chen sleep(3); 2265c497a3SShuo Chen loop->quit(); 2365c497a3SShuo Chen 2465c497a3SShuo Chen printf("exit main().\n"); 2565c497a3SShuo Chen} 26