Interprocess Communication and UNIX???

This is a discussion on Interprocess Communication and UNIX??? within the C Programming forums, part of the General Programming Boards category; hi, can anyone tell me What is the effect of the statement: actn.sa_flags = SA_RESTART; and what changes would you ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    19

    Interprocess Communication and UNIX???

    hi, can anyone tell me What is the effect of the statement:

    actn.sa_flags = SA_RESTART;

    and what changes would you make to the program to get it to behave in the same way if this statement were to be left out?

    the following is the full program..
    cheers,
    Atif.

    #include <stdio.h>
    #include <signal.h>
    #include <sys/types.h>
    #include <setjmp.h>

    #define SA_NULL (struct sigaction *)0

    int toolong;
    void wakeup(int);
    int number;
    int count = 0;
    jmp_buf savbuf;


    main()
    {
    struct sigaction actn;

    actn.sa_handler = wakeup;
    sigfillset( &(actn.sa_mask) );
    actn.sa_flags = SA_RESTART; //what is the effect of this statement

    sigaction(SIGALRM, &actn, SA_NULL);

    for(;
    {
    printf("Enter number: ");
    toolong = 0;
    alarm(10);
    if ( 0 == setjmp(savbuf) ) scanf("%d", &number);

    if ( !toolong ) break;

    if ( count == 1 ) /*First message*/
    printf("\nSee your ID card.\n");
    else /*Final message*/
    {
    printf("Time expired!\n");
    exit(1);
    }
    }
    alarm(0);
    printf("Number: %d\n", number);
    }

    void wakeup(int a)
    {
    toolong = 1;
    count++;
    printf("*********\n");
    longjmp(savbuf, 1 );
    }

  2. #2
    Unregistered
    Guest

    Smile

    Sure, if you dont mind...by the way what is RTFM


    Have you done any UNIX network programming before?

    kind regards,
    Atif

  3. #3
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > Sure, if you dont mind...by the way what is RTFM

    I think Mr. Salem was being sarcastic.
    RFTM - Read The "Fantastic" Manual

    > Have you done any UNIX network programming before?
    I don't think it was wise to ask Salem that..

    Definition of RTFM:
    http://www.tuxedo.org/~esr/faqs/smar...s.html#ANSWERS
    Last edited by Shadow; 05-17-2002 at 04:59 PM.
    The world is waiting. I must leave you now.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unkown Hang
    By Bladactania in forum C Programming
    Replies: 31
    Last Post: 04-22-2009, 09:33 AM
  2. Unix sockets
    By karas in forum Linux Programming
    Replies: 8
    Last Post: 10-13-2007, 12:20 AM
  3. passwd - Unix
    By jrfbaan in forum Linux Programming
    Replies: 3
    Last Post: 05-04-2005, 03:44 PM
  4. Unix Sockets
    By prvindia in forum Linux Programming
    Replies: 5
    Last Post: 03-11-2003, 08:16 AM
  5. Inter-Process Communication in Windows
    By JBravo in forum C++ Programming
    Replies: 3
    Last Post: 03-11-2002, 09:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21