1#include "EventLoop.h" 2#include "thread/Thread.h" 3#include <stdio.h> 4 5void threadFunc() 6{ 7 printf("threadFunc(): pid = %d, tid = %d\n", 8 getpid(), muduo::CurrentThread::tid()); 9 10 muduo::EventLoop loop; 11 loop.loop(); 12} 13 14int main() 15{ 16 printf("main(): pid = %d, tid = %d\n", 17 getpid(), muduo::CurrentThread::tid()); 18 19 muduo::EventLoop loop; 20 21 muduo::Thread thread(threadFunc); 22 thread.start(); 23 24 loop.loop(); 25 pthread_exit(NULL); 26} 27