You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/09/20 22:48:26 UTC

cvs commit: apr/include/arch/unix misc.h

wrowe       01/09/20 13:48:26

  Modified:    misc/unix otherchild.c
               include/arch/unix misc.h
  Log:
    Use the apr_proc_t, rather than some goofy pid/tid/handle value,
    for the process reference in the OC type.
  
  Reviewed by: Ryan Bloom
  
  Revision  Changes    Path
  1.25      +10 -10    apr/misc/unix/otherchild.c
  
  Index: otherchild.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/otherchild.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- otherchild.c	2001/05/17 12:20:01	1.24
  +++ otherchild.c	2001/09/20 20:48:26	1.25
  @@ -98,7 +98,7 @@
   
       ocr = apr_palloc(p, sizeof(*ocr));
       ocr->p = p;
  -    ocr->id = pid->pid;
  +    ocr->proc = pid;
       ocr->maintenance = maintenance;
       ocr->data = data;
       if (write_fd == NULL) {
  @@ -144,10 +144,10 @@
   
       for (ocr = other_children; ocr; ocr = nocr) {
           nocr = ocr->next;
  -        if (ocr->id != pid->pid)
  +        if (ocr->proc->pid != pid->pid)
               continue;
   
  -        ocr->id = -1;
  +        ocr->proc = NULL;
           (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status);
           return 0;
       }
  @@ -173,10 +173,10 @@
   
       for (ocr = other_children; ocr; ocr = nocr) {
           nocr = ocr->next;
  -        if (ocr->id == -1)
  +        if (ocr->proc == NULL)
               continue;
   
  -        rv = WaitForSingleObject((HANDLE) ocr->id, 0);
  +        rv = WaitForSingleObject(ocr->proc->hproc, 0);
           if (rv != WAIT_TIMEOUT) {
               (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1);
           }
  @@ -191,12 +191,12 @@
   
       for (ocr = other_children; ocr; ocr = nocr) {
           nocr = ocr->next;
  -        if (ocr->id == -1)
  +        if (ocr->proc == NULL)
               continue;
   
  -        waitret = waitpid(ocr->id, &status, WNOHANG);
  -        if (waitret == ocr->id) {
  -            ocr->id = -1;
  +        waitret = waitpid(ocr->proc, &status, WNOHANG);
  +        if (waitret == ocr->proc) {
  +            ocr->proc = NULL;
               (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status);
           }
           else if (waitret == 0) {
  @@ -204,7 +204,7 @@
           }
           else if (waitret == -1) {
               /* uh what the heck? they didn't call unregister? */
  -            ocr->id = -1;
  +            ocr->proc = NULL;
               (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1);
           }
       }
  
  
  
  1.29      +1 -1      apr/include/arch/unix/misc.h
  
  Index: misc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/misc.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- misc.h	2001/08/27 19:14:20	1.28
  +++ misc.h	2001/09/20 20:48:26	1.29
  @@ -91,7 +91,7 @@
   struct apr_other_child_rec_t {
       apr_pool_t *p;
       struct apr_other_child_rec_t *next;
  -    int id;  /* This is either a pid or tid depending on the platform */
  +    apr_proc_t *proc;
       void (*maintenance) (int, void *, int);
       void *data;
       apr_os_file_t write_fd;