Computing.Net > Forums > Programming > signal handling in C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

signal handling in C

Reply to Message Icon

Name: freshair
Date: September 4, 2004 at 20:17:41 Pacific
OS: M$ Windows
CPU/Ram: various
Comment:

I tried to use signal(SIGTERM,&handler()) to handle the Ctrl-C signal, but it didn't work. I also tried it with SIGINT, SIGKILL, SIGSTOP, SIGABRT, etc., but none had worked. what signal is the Ctrl-C?



Sponsored Link
Ads by Google

Response Number 1
Name: BlueRaja
Date: September 4, 2004 at 22:10:18 Pacific
Reply:

Ctrl+c sends the SIGINT signal.
Try changing the function call to:
signal(SIGINT,handler);
and remember to place it inside of main()

Hope that helps! ;P

AKhalifman@hotmail.com


0

Response Number 2
Name: freshair
Date: September 5, 2004 at 09:44:38 Pacific
Reply:

do you know how I can find the process ID of the child that signals the parent process?


0

Response Number 3
Name: BlueRaja
Date: September 5, 2004 at 12:24:03 Pacific
Reply:

I thought we were talking about DOS programming...?
Let's see your code.

AKhalifman@hotmail.com


0

Response Number 4
Name: freshair
Date: September 8, 2004 at 21:13:48 Pacific
Reply:

actually I'm doing C coding on Linux :P

the situation is that when I run a background process, the parent doesn't wait() for the child, but the child might still send a SIGCHLD to the parent, in which case the parent needs to handle it. I just want to know if there's a way to find the child's process ID (the source of SIGCHLD) by justing the signal.


0

Response Number 5
Name: BlueRaja
Date: September 9, 2004 at 15:34:02 Pacific
Reply:

No idea, don't program Linux - post this under the Linux board.

AKhalifman@hotmail.com


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

using the system funtion How private class is real...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: signal handling in C

file handling in c++ www.computing.net/answers/programming/file-handling-in-c/7365.html

file handling function in 'C'. www.computing.net/answers/programming/file-handling-function-in-c/2119.html

URL-highlighting TextBoxes in C#? www.computing.net/answers/programming/urlhighlighting-textboxes-in-c/12814.html