test2.cc revision a1bde736
1a1bde736SShuo Chen#include "EventLoop.h" 2a1bde736SShuo Chen#include "thread/Thread.h" 3a1bde736SShuo Chen 4a1bde736SShuo Chenmuduo::EventLoop* g_loop; 5a1bde736SShuo Chen 6a1bde736SShuo Chenvoid threadFunc() 7a1bde736SShuo Chen{ 8a1bde736SShuo Chen g_loop->loop(); 9a1bde736SShuo Chen} 10a1bde736SShuo Chen 11a1bde736SShuo Chenint main() 12a1bde736SShuo Chen{ 13a1bde736SShuo Chen muduo::EventLoop loop; 14a1bde736SShuo Chen g_loop = &loop; 15a1bde736SShuo Chen muduo::Thread t(threadFunc); 16a1bde736SShuo Chen t.start(); 17a1bde736SShuo Chen t.join(); 18a1bde736SShuo Chen} 19