Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> sigaction and signals in general
insaini
post Feb 12 2006, 12:21 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 12-February 06
Member No.: 6,059



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...

basically..

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..

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


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..

thanks

jaz
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th December 2017 - 09:17 PM