signal sending and waiting

This is a discussion on signal sending and waiting within the Linux Programming forums, part of the Platform Specific Boards category; Hey all we have a program that is supposed to fork to children, and each child calls a program which ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    9

    signal sending and waiting

    Hey all

    we have a program that is supposed to fork to children, and each child calls a program which is supposed to send 100 signals to the other child process

    now we have these programs sending signals, and we catch teh signals, and in the end we are supposed to time how long this takes

    now when our program sends 100 signals, it kills each process and nothing happens afterwards, there is supposed to be a way to block and handle these signals as they come in, they way i get it is its sending lots of signals and i guess we are not waiting before it is received before the next one is sent out (if that makes any sense)

    basically, we read about masks, and sigsuspend, and tried some stuff but no luck

    Code:
    sigset_t mask, oldmask;
    ...
    
    sigemptyset(&mask);
    sigaddset(&mask, SIGUSR1);
    
    sigprocmask (SIG_BLOCK, &mask, &oldmask);
    				while(***what goes here??***)
    						{
    							sigsuspend(&oldmask);
    						}
    				sigprocmask (SIG_UNBLOCK, &mask, NULL);
    now i got thsi example from elsewhere in this forum, in the while loop condition before the sig suspend, it said (!usr_interrupt), which they said waits for a user interrupt, how do we make a condition that says to wait for a signal interrupt, i think that may be our problem, any suggestions are appreciate, thanks!!!!

    i posted this in the C board, told it would be better here, what I changed since is i moved this sigsuspend portion to the program that is sneding the signal, i guess its correct but not sure, and I don't have an idea as how to handle the signals coming in, i can catch them, but how do i tell it to wait before recieving the next one, thanks

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I've never done this but it sounds like what you want to look at is pause

    www.delorie.com/gnu/docs/glibc/libc_512.html
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Qusetion about sending VK_CONTROL
    By tjpanda in forum Windows Programming
    Replies: 4
    Last Post: 12-04-2008, 12:06 PM
  2. signal sending and waiting
    By eva69 in forum C Programming
    Replies: 1
    Last Post: 10-03-2008, 12:03 PM
  3. Sending structures through the network
    By Mortissus in forum C Programming
    Replies: 3
    Last Post: 07-26-2007, 10:24 AM
  4. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 07:04 PM

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