VxWorks系统中的signal使用?
我有如下程序:
#include <vxWorks.h>
#include <sigLib.h>
#include <taskLib.h>
#include <stdio.h>
void catchSIGINT(int);
void sigCatcher(void);
#define NO_OPTIONS 0
#define ITER1 100
#define LONG_TIME 1000000
#define HIGHPRIORITY 100
#define LOWPRIORITY 101
int ownId;
void sigGenerator(void)
{
int i,j,taskId;
STATUS taskAlive;
if((taskId=taskSpawn("signal",100,0x100,20000,(FUNCPTR)
sigCatcher,0,0,0,0,0,0,0,0,0,0))==ERROR)
printf("taskSpawn sigCatcher failed\n");
ownId=taskIdSelf();
taskDelay(30);
for(i=0;i<ITER1;i++)
{
if((taskAlive=taskIdVerify(taskId))==OK)
{
printf("+++++++++++++++++++++++SIGINT signal
generated\n");
kill(taskId,SIGINT);
taskPrioritySet(ownId,LOWPRIORITY);
}
else
break;
}
printf("\n******************sigGeneratro
Exited***************\n");
}
void sigCatcher(void)
{
struct sigaction newAction;
int i,j;
newAction.sa_handler=catchSIGINT;
sigemptyset(&newAction.sa_mask);
newAction.sa_flags=NO_OPTIONS;
if(sigaction(SIGINT,&newAction,NULL)==-1)
printf("Could not install signal handler\n");
for(i=0;i<ITER1;i++)
{
for(j=0;j<LONG_TIME;j++);
printf("Normal processing in sigCatcher\n");
}
printf("\n+++++++++++++++++++++++++sigCatcher
Exited++++++++++++++++++\n");
}
void catchSIGINT(int signal)
{
printf("-----------------SIGINT signal caught\n");
taskPrioritySet(ownId,HIGHPRIORITY);
}
请问一个问题:
怎么在运行结果中没有"-------------------SIGINT signal caught"
也就是void catchSIGINT()函数好像没有调用,是这样吗?
望请高手指点!谢谢!