00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <signal.h>
00021 #include <unistd.h>
00022 #include <e32def.h>
00023
00027 int gVal = TRUE;
00028
00033 void SIGUSR2_handler(int signum)
00034 {
00035 if(signum == SIGUSR2)
00036 {
00037 printf("Received the SIGUSR2 signal from the sigusr1 process after reading the file.\n");
00038 gVal = FALSE;
00039 }
00040 }
00041
00049 int main(int argc,char **argv)
00050 {
00051 pid_t asyProcsID = atoi(argv[1]);
00052 char ch;
00053 int ret;
00054 int arg = argc;
00055
00056 signal(SIGUSR2, SIGUSR2_handler);
00057 printf("******************** In the sigusr2 process ********************\n");
00058
00059 printf("\nPress the Enter key to send the SIGUSR1 signal to the sigusr1 process\n");
00060 getchar();
00061 ret = kill(asyProcsID,SIGUSR1);
00062 if(ret)
00063 {
00064 printf("kill() failed to send signal, errno=%d\n",errno);
00065 gVal = FALSE;
00066 }
00067
00068
00069
00070
00071
00072
00073 while(gVal)
00074 {
00075 sleep(0);
00076 }
00077 printf("\nPress 'e'+Enter to exit from the sigusr2 process\n");
00078 while((ch = getchar())!= 'e')
00079 {
00080 if(ch == '\n')
00081 continue;
00082 else
00083 printf("The wrong option was selected, please try again!!!\n");
00084 }
00085 return EXIT_SUCCESS;
00086 }