test1.cc revision 427f165a
1460998e0SShuo Chen#include "EventLoop.h" 2427f165aSShuo Chen#include "thread/Thread.h" 3427f165aSShuo Chen#include <stdio.h> 4427f165aSShuo Chen 5427f165aSShuo Chenvoid threadFunc() 6427f165aSShuo Chen{ 7427f165aSShuo Chen printf("threadFunc(): pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid()); 8427f165aSShuo Chen 9427f165aSShuo Chen muduo::EventLoop loop; 10427f165aSShuo Chen loop.loop(); 11427f165aSShuo Chen} 12460998e0SShuo Chen 13460998e0SShuo Chenint main() 14460998e0SShuo Chen{ 15427f165aSShuo Chen printf("main(): pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid()); 16427f165aSShuo Chen 17460998e0SShuo Chen muduo::EventLoop loop; 18427f165aSShuo Chen 19427f165aSShuo Chen muduo::Thread thread(threadFunc); 20427f165aSShuo Chen thread.start(); 21427f165aSShuo Chen 22460998e0SShuo Chen loop.loop(); 23427f165aSShuo Chen pthread_exit(NULL); 24460998e0SShuo Chen} 25