LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-01-2009, 04:57 AM   #1
12w23e
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Rep: Reputation: 0
using fork with pselect problam


hello,

when i use fork with my program , the program waits in the pselect

untill the child process ends.

why?
 
Old 01-01-2009, 06:11 AM   #2
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
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.
 
Old 01-01-2009, 06:30 AM   #3
12w23e
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
i mean that the pselect get stuck until the child process ends.

and i need the father process will continue working while the child still works.
 
Old 01-01-2009, 06:52 AM   #4
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
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.
 
Old 01-01-2009, 08:22 AM   #5
12w23e
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
well , i found the problam

i had a probalm in my sigchild

i didnt use waitpid as i should use it.

thanks for all.

closed.
 
Old 01-01-2009, 04:40 PM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Usually that sort of problem happens if the parent fails to close the end of a pipe/socket that it won't be using.
ta0kira
 
Old 01-01-2009, 06:08 PM   #7
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Usually that sort of problem happens if the parent fails to close the end of a pipe/socket that it won't be using.
Correct. Either that, or the child fails to do this.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit from blocked pselect() noisebleed Programming 5 12-16-2008 07:10 PM
maillog problam jyoti100in *BSD 2 01-03-2006 02:59 PM
pselect threads signals b2na Programming 2 12-31-2004 10:50 AM
smaba problam ! on suse 9.1 starking Linux - Networking 1 07-04-2004 08:04 AM
pselect function. nio99 Linux - Software 0 12-14-2002 08:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:23 AM.

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