int ACE_TMAIN (int, ACE_TCHAR *[]) { #if defined (ACE_HAS_THREADS) ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) MGet_Test started\n"))); ACE_Reactor* reactor = ACE_Reactor::instance (); #if 1 ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) starting serialized test\n"))); Get_Task get_task (ACE_Thread_Manager::instance (), n_threads); // run event loop until ended by last task thread reactor->run_event_loop (); // all threads really ended? ACE_Thread_Manager::instance ()->wait (); // All threads should have resulted in the same data... if (get_task.results ().size () != ACE_Utils::truncate_cast<size_t> (n_threads)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%d results found; ") ACE_TEXT ("should be %d\n"), get_task.results ().size (), n_threads)); } else { const ACE_Array<ACE_CString>& results = get_task.results (); for (int i=1; i < n_threads; ++i) { if (results[0] != results[i]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("result %d does not match other results\n"), i)); } } } #endif ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) starting parallelized test\n"))); reactor->reset_event_loop (); Get_MultiTask get_multi_task (ACE_Thread_Manager::instance ()); // run event loop until ended by last task thread reactor->run_event_loop (); // all threads really ended? ACE_Thread_Manager::instance ()->wait (); // All threads should have resulted in data... if (get_multi_task.failures () > 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%d failures found"), get_multi_task.failures ())); } ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) MGet_Test finished\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ return 0; }