Thread: alarm pipe

  1. #1
    Registered User jacktibet's Avatar
    Join Date
    Mar 2003
    Posts
    18

    alarm pipe

    hi,
    #include<signal.h>
    #include<stdio.h>

    void handler();
    int alarmflag=0;

    {
    signal(14,handler);
    alarm(3);
    while(!alarmflag)
    {
    pause();
    printf("signal received\n");
    }
    printf("loop ends");
    }

    void handler()
    {
    printf("an alarm signal was received\n");
    alarmflag=1;
    }

    here, what is alarm? what is the function handler, it
    is a new process or not? when it will be run. please tell me
    thank you very much.
    Code:
    ss
    Jack

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    Alarms are used in conjunction with signals to determine if an event has occured or not.

    If a signal triggers an event then it updates the alarmflag variable and the function alarm is used for this purpose i guess.

    Based on the alarmflag value set your program could take the appropriate action required.

    Hope this sufficies.

  3. #3
    Registered User jacktibet's Avatar
    Join Date
    Mar 2003
    Posts
    18
    is the function handler a process?
    when it will be run ?
    Jack

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cont of IPC using PIPE
    By BMathis in forum C Programming
    Replies: 1
    Last Post: 03-15-2009, 05:16 PM
  2. Pipe class.
    By eXeCuTeR in forum Linux Programming
    Replies: 8
    Last Post: 08-21-2008, 03:44 AM
  3. Pipe(): Interprocess or Intraprocess comm?
    By @nthony in forum C Programming
    Replies: 2
    Last Post: 03-28-2007, 07:27 PM
  4. Having trouble with a named pipe
    By crazeinc in forum C Programming
    Replies: 2
    Last Post: 05-13-2005, 01:00 AM
  5. Pipe the console from a DLL
    By loobian in forum Windows Programming
    Replies: 12
    Last Post: 11-30-2003, 08:55 PM