ACE文章中的事件触发例子,怎么就触发不了
下面的是ace文章中的例子,就是没进事件触发函数,是不是缺了什么配置阿
#include "ace/Reactor.h"
#include "ace/Event_Handler.h"
#include "ace/OS.h"
//int SIGWINCH=1,SIGINT=2;
const int SIGNT=2;
const int SIGWINCH=1;
//const int SIGINT=2;
class MyEventHandler: public ACE_Event_Handler
{
int handle_signal(int signum, siginfo_t*,ucontext_t*)
{
switch(signum)
{
case SIGWINCH:
ACE_DEBUG((LM_DEBUG, "You pressed SIGWINCH \n"));
break;
case SIGINT:
ACE_DEBUG((LM_DEBUG, "You pressed SIGINT \n"));
break;
}
return 0;
}
};
int main(int argc, char *argv[])
{
//instantiate the handler
MyEventHandler *eh =new MyEventHandler;
ACE_Reactor::instance()->register_handler(SIGWINCH,eh);
ACE_Reactor::instance()->register_handler(SIGINT,eh);
ACE_OS::kill(ACE_OS::getpid(),SIGWINCH);
ACE_OS::kill(ACE_OS::getpid(),SIGINT);
while(1)
//Start the reactors event loop
ACE_Reactor::instance()->handle_events();
}