本文整理汇总了C++中ACE_Reactor::end_reactor_event_loop方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Reactor::end_reactor_event_loop方法的具体用法?C++ ACE_Reactor::end_reactor_event_loop怎么用?C++ ACE_Reactor::end_reactor_event_loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Reactor
的用法示例。
在下文中一共展示了ACE_Reactor::end_reactor_event_loop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
~ServerInstance()
{
udpReactor.end_reactor_event_loop();
tcpReactor.end_reactor_event_loop();
if(tcp_thread >= 0)
ACE_Thread_Manager::instance ()->wait_grp(tcp_thread);
ACE_Thread_Manager::instance ()->wait_grp(udp_thread);
}
示例2:
void
TAO_Thread_Lane_Resources::shutdown_reactor (void)
{
TAO_Leader_Follower &leader_follower = this->leader_follower ();
ACE_GUARD (TAO_SYNCH_MUTEX,
ace_mon,
leader_follower.lock ());
ACE_Reactor *reactor = leader_follower.reactor ();
// Wakeup all the threads waiting blocked in the event loop, this
// does not guarantee that they will all go away, but reduces the
// load on the POA....
// If there are some client threads running we have to wait until
// they finish, when the last one does it will shutdown the reactor
// for us. Meanwhile no new requests will be accepted because the
// POA will not process them.
if (!this->orb_core_.resource_factory ()->drop_replies_during_shutdown () &&
leader_follower.has_clients ())
{
reactor->wakeup_all_threads ();
}
else
{
// End the reactor if we want shutdown dropping replies along the
// way.
reactor->end_reactor_event_loop ();
}
}
示例3: r
bool
testit (ACE_Reactor_Impl *ri)
{
int ret = 0;
ACE_Reactor r (ri);
ACE_Time_Value one (1);
r.end_reactor_event_loop ();
if ((ret = r.handle_events (one)) != -1)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Return value %d should be -1\n"), ret));
return false;
}
if (errno != ESHUTDOWN)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("errno %d should be %d (ESHUTDOWN)\n"),
errno, ESHUTDOWN));
return false;
}
return true;
}
示例4: sa
int
run_main (int argc, ACE_TCHAR *argv[])
{
int retval = 0;
MCT_Config config;
retval = config.open (argc, argv);
if (retval != 0)
return 1;
const ACE_TCHAR *temp = ACE_TEXT ("Multicast_Test");
ACE_TString test = temp;
u_long role = config.role ();
if (ACE_BIT_DISABLED (role, MCT_Config::PRODUCER)
|| ACE_BIT_DISABLED (role, MCT_Config::CONSUMER))
{
if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER))
test += ACE_TEXT ("-PRODUCER");
else
test += ACE_TEXT ("-CONSUMER");
}
// Start test only if options are valid.
ACE_START_TEST (test.c_str ());
// Register a signal handler to close down application gracefully.
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
// Dump the configuration info to the log if caller passed debug option.
if (config.debug ())
config.dump ();
ACE_Reactor *reactor = ACE_Reactor::instance ();
MCT_Task *task = new MCT_Task (config, reactor);
if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER))
{
ACE_DEBUG ((LM_INFO, ACE_TEXT ("Starting consumer...\n")));
// Open makes it an active object.
retval += task->open ();
}
// now produce the datagrams...
if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER))
retval += producer (config);
if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER))
{
// and wait for everything to finish
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("start waiting for consumer to finish...\n")));
// Wait for the threads to exit.
// But, wait for a limited time since we could hang if the last udp
// message isn't received.
ACE_Time_Value max_wait ( config.wait ()/* seconds */);
ACE_Time_Value wait_time (ACE_OS::gettimeofday () + max_wait);
ACE_Time_Value *ptime = ACE_BIT_ENABLED (role, MCT_Config::PRODUCER)
? &wait_time : 0;
if (ACE_Thread_Manager::instance ()->wait (ptime) == -1)
{
// We will no longer wait for this thread, so we must
// force it to exit otherwise the thread will be referencing
// deleted memory.
finished = 1;
reactor->end_reactor_event_loop ();
if (errno == ETIME)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("maximum wait time of %d msec exceeded\n"),
max_wait.msec ()));
else
ACE_OS::perror (ACE_TEXT ("wait"));
++error;
// This should exit now that we ended the reactor loop.
task->wait ();
}
}
delete task;
ACE_END_TEST;
return (retval == 0 && error == 0) ? 0 : 1;
}