1c903e3e8SShuo Chen#include "EventLoop.h" 2427f165aSShuo Chen#include "thread/Thread.h" 3427f165aSShuo Chen#include <stdio.h> 4427f165aSShuo Chen 5427f165aSShuo Chenvoid threadFunc() 6427f165aSShuo Chen{ 70615e80eSShuo Chen printf("threadFunc(): pid = %d, tid = %d\n", 80615e80eSShuo Chen getpid(), muduo::CurrentThread::tid()); 9427f165aSShuo Chen 10427f165aSShuo Chen muduo::EventLoop loop; 11427f165aSShuo Chen loop.loop(); 12427f165aSShuo Chen} 13c903e3e8SShuo Chen 14c903e3e8SShuo Chenint main() 15c903e3e8SShuo Chen{ 160615e80eSShuo Chen printf("main(): pid = %d, tid = %d\n", 170615e80eSShuo Chen getpid(), muduo::CurrentThread::tid()); 18427f165aSShuo Chen 19c903e3e8SShuo Chen muduo::EventLoop loop; 20427f165aSShuo Chen 21427f165aSShuo Chen muduo::Thread thread(threadFunc); 22427f165aSShuo Chen thread.start(); 23427f165aSShuo Chen 24c903e3e8SShuo Chen loop.loop(); 25427f165aSShuo Chen pthread_exit(NULL); 26c903e3e8SShuo Chen} 27