|
发表于 2009-5-16 22:02:37
|
显示全部楼层
#include "stdafx.h"
#include <ace/WIN32_Proactor.h>
class WinProactor :ACE_Task<ACE_MT_SYNCH>
{
public:
int Start()
{
ACE_WIN32_Proactor* winImp = new ACE_WIN32_Proactor;
ACE_Proactor* proactor = new ACE_Proactor(winImp, 0);
ACE_Proactor::instance(proactor, 0);
return 0;
}
int Stop()
{
ACE_Proactor::end_event_loop();
wait();
return 0;
}
int svc()
{
ACE_Proactor::run_event_loop();
return 0;
}
};
int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
{
ACE_Service_Config::open(argc, argv, ACE_DEFAULT_LOGGER_KEY, true, false, true);
WinProactor proactor;
proactor.Start();
while(TCHAR c = getchar())
{
if('q' == c)
break;
if('r' == c)
ACE_Service_Config::reconfigure();
}
proactor.Stop(); // 如果输入r执行了reconfigure,这里的调用将阻塞在wait上面
return 0;
} |
|