Have you heard of the concept of simplifying to a small test case? Anyway that said AFAIKS the problem is that in your incredibly misnamed new_thread routine you are doing this:
if ( $pid = fork() ) { $threads++; # you mean kids return $pid } # this is kid code # kid does socket but.....then...... exit($result);
So the child process is exiting but you are not decrementing the '$thread' count, at least in the code presented. Nor are you communicating its death to the parent. So the reason you are getting a no children error is simple -> *there are no children* because they have finished but the parent simply does not know it.
At a glance I don't see how you think the IPC between parent and child is going to work, and given the length of your sample and what I find really inaccurate and annoying names (ie a forked kid is not a thread) a glance is all it is going to get. When you fork parent and child get copies of all data and handles. Independent* copies so if the kid does stuff to the data the parents data remains unchanged.
* yes I understand COW.
cheers
tachyon
In reply to Re: mixing multisockets and forks
by tachyon
in thread mixing multisockets and forks
by fxmakers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |