jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Annoying problem with subprocesses


sdupont@xxxxxxx <sdupont@xxxxxxx> wrote:
>1. the process (0) gets killed in jed_close_process(),
>   signal_handler will do cleanup (but not yet)
>2. new process (1) is created with open_process(),
>   no cleanup done so far
>3. sys_input_pending() is trying to read_process_input() 
>   and than it happens "what never should happen":
>   Since cleanup wasn't done or wasn't ready, Num_Subprocesses
>   is 2 (0 and 1) though in fact there is only one (1).

"what should never happen" happens in the get_process function.  And
that only happens if p->flags is 0.  It is not clear to me how
p->flags is getting set to 0.  The only place I can see this happening
is in the child_signal_handler after the call to waitpid.  Does adding
a check for status==0 after waitpid help?  That is, use:

        pid = (int) waitpid (-1, &status, WNOHANG | WUNTRACED);
        if (pid == -1)
          {
             if (errno == ECHILD) break;
             continue;
          }
	   .
	   .
	 /* What else?? */

/* ADD CHECK HERE */
	if (status == 0)  
	  continue;

        p = Processes;
	pmax = p + MAX_PROCESSES;

If that solves the problem, my next question is what does status==0
mean?

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]