本文整理汇总了C++中Acceptor::wait方法的典型用法代码示例。如果您正苦于以下问题:C++ Acceptor::wait方法的具体用法?C++ Acceptor::wait怎么用?C++ Acceptor::wait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acceptor
的用法示例。
在下文中一共展示了Acceptor::wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_manager
// *************************************************************
// Configuration helpers
// *************************************************************
int
run (int argc, ACE_TCHAR *argv[])
{
int rc = 0;
ProactorTask task1(cfg);
if (task1.start () != 0)
{
task1.stop ();
return -1;
}
task1.enable_event_loop();
RecvFactory r_factory;
SendFactory s_factory;
PConnectionManager r_manager (task1, r_factory,"R_Manager");
PConnectionManager s_manager (task1, s_factory,"S_Manager");
Acceptor acceptor (r_manager);
Connector connector (s_manager);
ACE_Time_Value time_begin = ACE_OS::gettimeofday ();
ACE_Time_Value time_end = ACE_OS::gettimeofday ();
ACE_Time_Value time_run;
ACE_Time_Value timeout (cfg.timeout(), 0);
r_manager.set_timeout (timeout);
s_manager.set_timeout (timeout);
time_begin = ACE_OS::gettimeofday ();
if (cfg.both() != 0 || cfg.connections () == 0) // Acceptor
{
// Simplify, initial read with zero size
if (acceptor.start (ACE_INET_Addr (cfg.listen_port())) == 0)
rc = 1;
}
if (cfg.both() != 0 || cfg.connections () > 0) // Connector
{
ACE_INET_Addr addr;
addr.set (cfg.connect_port(), cfg.connect_host());
rc += connector.start (addr, cfg.connections ());
}
if (rc > 0)
{
//task1.enable_event_loop();
ACE_Time_Value sleep_time (cfg.seconds());
while ( sleep_time != ACE_Time_Value::zero)
{
ACE_Countdown_Time countdown ( & sleep_time );
ACE_OS::sleep (sleep_time );
}
if (cfg.seconds () == 0)
{
bool flgExit = false;
for (;!flgExit;)
{
char c;
cout << "\nEnter:"
<< "\n1 - stop connector"
<< "\n2 - stop acceptor"
<< "\n3 -stop senders"
<< "\n4 -stop receivers"
<< "\nP - statistic"
<< "\nQ quit=>"
<< flush;
cin.clear ();
cin >> c;
switch (toupper (c))
{
case '1':
connector.cancel();
connector.wait ();
break;
case '2':
acceptor.cancel ();
acceptor.wait();
break;
case '3':
s_manager.cancel ();
while (!s_manager.is_safe_to_delete ())
//.........这里部分代码省略.........