Thread: Signal Handlers

  1. #1
    Microsoft. Who? MethodMan's Avatar
    Join Date
    Mar 2002
    Posts
    1,198

    Signal Handlers

    Hi

    I have a program with two forks and a parent process runinng. When ^Z is inputed, if the parent catches it, it kills the children, if a child catches it, it tells the parent and the parent kills the other child.

    I am having problems figuring out how to accomplish this.

    Should each child share its own handler, or should the parent and both children have a common handler?

    Thanks
    -MethodMan-

    Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.

    Homepage: http://www.freewebs.com/andy_moog/home.html

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    What you want is kill(). And use SIGUSR1 for your inter-process signalling.
    Of course, there many other ways for inter-process communication: pipes, FIFOs, message queues, shared memory, and even sockets (all SVR4 stuff).

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 07-07-2009, 10:05 AM
  2. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  3. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM
  4. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM
  5. signal handling
    By trekker in forum C Programming
    Replies: 2
    Last Post: 07-05-2002, 02:52 AM