Ther are two process in my program and i want both to constantly running. So i have written the following code. But one of this process which is calling function wsJobCheck() is getting terminated with giving message : Program exited normally.
Can any one suggest why this is happing.
Code :
#include"listen_to_ms.h"
#include"job_header.h" /*all headers files are included in this header file*/
#include"ws_job_check.h"
extern void callWSJobCheck(int);
int main()
{
/* declaration */
pid_t childpid;
int j=0;
struct passwd *pwd;
/* creating a new child process */
childpid=fork();
if(childpid==0)
{
/* crete processes for listening to WS */
listenToMS();
exit(0);
}
if(signal(SIGALRM,callWSJobCheck)==SIG_ERR)
{
fprintf(stderr, "\nIN MAIN FUNCTION : Error in SIGALRM\n");
}
else
{
alarm(20);
}
return 0;
}
void callWSJobCheck(int signal)
{
wsJobCheck();
alarm(10);
printf("\nIN MAIN FUNCTION : signal : %d",signal);
}
I am working on AIX os.