The following problem may be simple for you, so I hope someone can answerhere. We've got a complex software using child processes and a tableto keep data of them together, like this:

childs[n].pid=fork();

where "n" is an integer contains a free "slot" in the childs struct array.

I also handle SIGCHLD in the parent and signal handler searches the childsarray for the pid returned by waitpid(). However here is my problem. Thechild process can be fast, ie exits before scheduler of the kernel givechance the parent process to run, so storing pid into childs[n].pid in theparent context is not done yet. Child may exit, than scheduler gives controlto the signal handler before doing the store of the pid (if child run formore time, eg 10 seconds it works of course). So it's impossible to storechild pids and search by that information in eg the signal handler? It'squite problematic, since the code uses blocking I/O a lot, so othersolutions (like searching in childs[] in the main program and not in signalhandler) would require to recode the whole project. The problem can beavoided with having a fork() run the PARENT first, but I thing this is doneby the scheduler so it's a kernel issue. Also the problem that source shouldbe portable between Linux and Solaris ...

Sorry for disturbing the list with this kind of problem but I can't findany solution elsewhere.