ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do you mean that you expect pselect() to return for some other reason, but it gets stuck there until a child ends?
Or do you mean that an ending child causes the pselect() to return earlier than you expected?
If it's the second of those two, you have enabled signal SIGCHLD in the signal mask parameter to the pselect(). Whenever a child ends, the parent's process will receive signal SIGCHLD if that signal is enabled in the parent process.
There's no inherent reason that pselect() should hang until the child process ends. This sounds like a standard debugging situation.
If playing with the program doesn't reveal the problem, then as I see it you have two ways to go.
The first way would be to set aside the code as it exists now, make a playing copy of the code, and in that playing copy rip out things until the pselect() works. This can consume a lot of time.
The second way can also consume a lot of time. Write a simple program from scratch which demonstrates that pselect() works. Then add a child process to that simple code, and see that pselect() still works. Then add more and more of your original features until you discover where pselect() doesn't work any more.
But maybe someone else on lq has a better idea. I'm hoping someone does.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.