Cytat został ukryty, ponieważ ignorujesz tego użytkownika. Pokaż cytat.
(oprocz Delphi. Delphi nie)
Dreaming by drumming. ™
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
//struct
int MAXFUEL = 100;
int fuelLevel = 0;
void handler(int sig)
{
printf("PLANE: In Signal Handler");
printf("PLANE: Signal id %d received", sig);
if(sig==SIGALRM)
{
printf("\nSIGALRM\n");
}
if(sig==SIGUSR2)
{
printf("\nSIGURS2\n");
}
}
int main()
{
signal(SIGUSR2, handler); // refuel signal.
signal(SIGALRM, handler); // update fuel
printf("PLANE: Started %d\n " , getpid());
alarm(3);
while (1)
{
sleep(10);
}
return 0;
}
Ostatnio zmieniony przez dzeejkop : 02-03-2016, 22:19
kill(pid, SIGUSR2);
ipse se nihil scire id unum sciat
Aktualnie 4 użytkowników przegląda ten temat. (0 użytkowników i 4 gości)
Zakładki