test2.cc revision 65c497a3
165c497a3SShuo Chen#include "EventLoop.h" 265c497a3SShuo Chen#include "thread/Thread.h" 365c497a3SShuo Chen 465c497a3SShuo Chenmuduo::EventLoop* g_loop; 565c497a3SShuo Chen 665c497a3SShuo Chenvoid threadFunc() 765c497a3SShuo Chen{ 865c497a3SShuo Chen g_loop->loop(); 965c497a3SShuo Chen} 1065c497a3SShuo Chen 1165c497a3SShuo Chenint main() 1265c497a3SShuo Chen{ 1365c497a3SShuo Chen muduo::EventLoop loop; 1465c497a3SShuo Chen g_loop = &loop; 1565c497a3SShuo Chen muduo::Thread t(threadFunc); 1665c497a3SShuo Chen t.start(); 1765c497a3SShuo Chen t.join(); 1865c497a3SShuo Chen} 19