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