本文整理汇总了C++中ACE_Reactor::reset_event_loop方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Reactor::reset_event_loop方法的具体用法?C++ ACE_Reactor::reset_event_loop怎么用?C++ ACE_Reactor::reset_event_loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Reactor
的用法示例。
在下文中一共展示了ACE_Reactor::reset_event_loop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_task
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;
}