| 62 | }; |
| 63 | |
| 64 | int main() |
| 65 | { |
| 66 | std::unique_ptr<Printer> printer; // make sure printer lives longer than loops, to avoid |
| 67 | // race condition of calling print2() on destructed object. |
| 68 | muduo::net::EventLoop loop; |
| 69 | muduo::net::EventLoopThread loopThread; |
| 70 | muduo::net::EventLoop* loopInAnotherThread = loopThread.startLoop(); |
| 71 | printer.reset(new Printer(&loop, loopInAnotherThread)); |
| 72 | loop.loop(); |
| 73 | } |
| 74 |