In article <[EMAIL PROTECTED]>,
Mihaly Zachar <[EMAIL PROTECTED]> writes:
> Kiss Gabor wrote:
>> Bizonyito ereju kis farkinca C program, amelyik
>> egyreszt megprobal signal()-t hivni, hogy lassa tud-e
>> handlert allitani, masreszt megnezi, hogy a visszateresi ertek
>> (az elozo handler) SIG_IGN vagy SIG_DFL.
>>
>> Aztan ennek is kuldhetsz signalt, hogy lasd mit csinal.
>>
>>
>
> #include <stdio.h>
> #include <signal.h>
>
> void catch(int sig)
> {
> printf("Alarm signal catched: %d\n", sig);
> }
>
> void interrupt(int sig)
> {
> printf("Interrupted.\n");
> exit(1);
> }
>
> int main()
> {
sighandler_t oldhdlr;
> signal (SIGALRM, catch);
> signal(SIGINT, interrupt);
oldhdlr=signal(SIGINT, interrupt);
if (oldhdlr==SIG_IGN)
printf("SIG_IGN volt\n");
else if (oldhdlr==SIG_DFL)
printf("SIG_DFL volt\n");
else
printf("Egyeb: %p\n",oldhdlr);
>
> alarm(2);
>
> while (1) continue;
> return 0;
> }
>
> szepen elkapja a SIGALRM-ot, de kivulrol nem kapja meg a SIGINT-et :(
>
> kapjabe :(
> _________________________________________________
> linux lista - [email protected]
> http://mlf2.linux.rulez.org/mailman/listinfo/linux
_________________________________________________
linux lista - [email protected]
http://mlf2.linux.rulez.org/mailman/listinfo/linux