test1.cc revision 9a1e991d
19a1e991dSShuo Chen#include "EventLoop.h" 29a1e991dSShuo Chen#include "thread/Thread.h" 39a1e991dSShuo Chen#include <stdio.h> 49a1e991dSShuo Chen 59a1e991dSShuo Chenvoid threadFunc() 69a1e991dSShuo Chen{ 79a1e991dSShuo Chen printf("threadFunc(): pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid()); 89a1e991dSShuo Chen 99a1e991dSShuo Chen muduo::EventLoop loop; 109a1e991dSShuo Chen loop.loop(); 119a1e991dSShuo Chen} 129a1e991dSShuo Chen 139a1e991dSShuo Chenint main() 149a1e991dSShuo Chen{ 159a1e991dSShuo Chen printf("main(): pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid()); 169a1e991dSShuo Chen 179a1e991dSShuo Chen muduo::EventLoop loop; 189a1e991dSShuo Chen 199a1e991dSShuo Chen muduo::Thread thread(threadFunc); 209a1e991dSShuo Chen thread.start(); 219a1e991dSShuo Chen 229a1e991dSShuo Chen loop.loop(); 239a1e991dSShuo Chen pthread_exit(NULL); 249a1e991dSShuo Chen} 25