Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6750185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:46:42+00:00 2026-05-26T12:46:42+00:00

I’m not sure if I’m trying to stick a square peg into a round

  • 0

I’m not sure if I’m trying to stick a square peg into a round hole, but I’m trying to use signals to coordinate five or six child processes with their parent. I have the parent setup to handle those signals

signal(1, SigControllerCarWaiting1);
signal(2, SigControllerCarWaiting2);
signal(3, SigControllerCarWaiting3);
signal(4, SigControllerCarWaiting4);
signal(5, SigControllerCarWaiting5);

signal(6, SigControllerCarEnter1);
signal(7, SigControllerCarEnter2);
signal(8, SigControllerCarEnter3);
signal(9, SigControllerCarEnter4);
signal(10, SigControllerCarEnter5);

And it mostly works. When I run my program, many times it will complete as expected. But some of the time, it will fail to override the default behavior and my parent process will output something like ‘Hangup’ and then terminate….leaving a bunch of children still executing.

I’ve tried re-establishing the signal in the handler like…

void SigControllerCarWaiting5() { signal(5, SigControllerCarWaiting5); SigControllerCarWaiting(4); }
void SigControllerCarWaiting4() { signal(4, SigControllerCarWaiting4); SigControllerCarWaiting(3); }
void SigControllerCarWaiting3() { signal(3, SigControllerCarWaiting3); SigControllerCarWaiting(2); }
void SigControllerCarWaiting2() { signal(2, SigControllerCarWaiting2); SigControllerCarWaiting(1); }
void SigControllerCarWaiting1() { signal(1, SigControllerCarWaiting1); SigControllerCarWaiting(0); }

But it doesn’t seem to have an impact. Sometimes it runs great; other times it will fail with the signal text and kill the parent. I’m very new to all of this and thought someone could point me in the correct direction. Is there something other than ‘signal(ID, Function) I should use to capture multiple incoming signals?

If I run it with only one child process it never seems to fail. So I’m assuming it has to do with a race-condition of sorts between the children….but I haven’t been able to make any progress in tracking it down.

EDIT

After further investigation, I found sites that recommended using sigaction instead of signal…but I still seem to have the same problem. Sometimes, the signal doesn’t get handled by me, and causes my process to end prematurely.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:46:43+00:00Added an answer on May 26, 2026 at 12:46 pm

    Live and learn…

    When using signal; if two children sent the same signal at the same time, the first would be processed by my handler but the second would be executed before the handler had re-established itself as the handler, causing the default behavior to happen.

    Changing to sigaction does prevent this. However, it still ‘failed’ on certain signals (specifically 9 or SIGKILL because the system will not allow you to override the SIGKILL behavior).

    So, my solution is to use sigaction and not use SIGKILL for my own custom communication.

    Beyond that; it seems like, as others have suggested, pipes or semaphores would be better tools to use in this situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.