Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-11-2005, 08:53 AM   #1
LQ Newbie
Registered: Nov 2005
Posts: 6

Rep: Reputation: 0
How to use SIGUSR1 and SIGUSR2

I've already searched in google and man pages but I don't understand how to use SIGUSR1 and SIGUSR2.

I read somewhere that it is possible to make a subprocess with fork(), then pause the subprocess and wake it up by sending a signal (with SIGUSR1 or SIGUSR2) at some other point of the program. How could I do this?
I know how to make subprocesses but I don't know how to program a signal with SIGUSR1 and how wake up the subprosses with that signal.

Thx for help
Old 12-11-2005, 09:16 AM   #2
Registered: Dec 2004
Location: India
Distribution: Fedora Core 4
Posts: 145

Rep: Reputation: 15
I will illustrate with an example:

say u need to create an user defined signal SIGUSR1.....

I'm considering a child process..

//Child context (consider it needs to send a kill signal to parent)


//parent context


In this the kill signal is sensed by the parent ( as SIGUSR1)

if u need to use one more signal use it as SIGUSR2.
Old 12-11-2005, 10:41 AM   #3
LQ Newbie
Registered: Nov 2005
Posts: 6

Original Poster
Rep: Reputation: 0
ah, thanks a lot.

Another question: is it possible to send other signals than the kill signal or is that the only one?
Old 12-11-2005, 06:18 PM   #4
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Rep: Reputation: 31
Originally Posted by YaK.
Another question: is it possible to send other signals than the kill signal or is that the only one?
this sends SIGUSR1 to the process with pid given as parameter. Instead of SIGUSR1, you can send SIGKILL, SIGSTOP, etc.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration