#include "stdio.h"
#include "signal.h"
main()
{
void wakeup(int);
printf("about to sleep for 4 seconds\n");
signal(SIGALRM,wakeup);
alarm(4);
int i;
for(i=0;i<6;i++)
{
printf("some other thing %d\n",i);
sleep(1);
}
}
void wakeup(int signum)
{
printf("Alarm received from kernel\n");
}