ACE中使用线程池的简单方法

static ACE_THR_FUNC_RETURN event_loop (void *arg) { ACE_Reactor *reactor = static_cast (arg); reactor->owner (ACE_OS::thr_self ()); reactor->run_reactor_event_loop (); return 0; } int ACE_TMAIN(int argc, TCHAR* argv[]) { ACE::init(); int result = 0; const size_t N_THREADS = 4; ACE_TP_Reactor tp_reactor; ACE_Reactor reactor (&tp_reactor); auto_ptr delete_instance ACE_Thread_Manager::instance ()->spawn_n (N_THREADS, event_loop, ACE_Reactor::instance ()); ACE_Thread_Manager::instance ()->wait (); ACE::fini(); return result; }

你可能感兴趣的:(ACE中使用线程池的简单方法)