Hi all.. im in need of some serious help.. i cant find any examples anywhere on how to use signals.. even a little ishy example.. i simply dont understand how to use them...


i have to write a simple chat program where a signal is sent USR1 to another process PID which happens when a user sends a message. The signal is to instruct the other process to 'wake up' .. to display the message then ask for a reply.. once its done replying.. it is supposed to suspend or make the process wait on the other process and so on etc..

i believe to send the signal its kill (pid, SIGUSR1) .. how do I make a process wait on this signal? .. how exactly does a process receive this signal and what does it do or where does it go when it receives this signal?

I have a method which is my method handler..

void messageHandler (int sig, siginfo_t *info, void *ctx)
       if (sig == SIGUSR1)
               fprintf(stdout, "SENDER PID: %d", info->si_pid);

this is a very simple message handler which Is just used to test.. its just printing out the PID of the process that sent the signal.. but I dont see how this method is ever called..