IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 14, 2005, 10:33:53 AM (21 years ago)
Author:
eugene
Message:

cleanup up communications for speed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/StopHosts.c

    r4762 r4763  
    2929int StopHost (Host *host) {
    3030
    31   int       result;
    32   int       waitstatus;
    3331  int       status;
    3432  IOBuffer  buffer;
     
    5351      exit (1);
    5452  }
     53  HarvestHost (host[0].pid);
     54  return (TRUE);
     55}
    5556
    56   /* check current child status */
     57void DownHost (Host *host) {
     58  CLOSE (host[0].stdin);
     59  CLOSE (host[0].stdout);
     60  CLOSE (host[0].stderr);
     61  host[0].job = NULL;
     62  PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
     63}
     64
     65void OffHost (Host *host) {
     66  CLOSE (host[0].stdin);
     67  CLOSE (host[0].stdout);
     68  CLOSE (host[0].stderr);
     69  host[0].job = NULL;
     70  PutHost (host, PCONTROL_HOST_OFF, STACK_BOTTOM);
     71}
     72
     73int HarvestHost (int pid) {
     74 
     75  int       result;
     76  int       waitstatus;
     77
    5778  /* I probably should loop a few time with max timeout larger than 10ms... */
    5879  usleep (10000);
    59   result = waitpid (host[0].pid, &waitstatus, WNOHANG);
     80  result = waitpid (pid, &waitstatus, WNOHANG);
    6081  switch (result) {
    6182    case -1:  /* error with waitpid */
     
    83104
    84105    default:
    85       if (result != host[0].pid) {
    86         fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d).  programming error\n", result, host[0].pid);
     106      if (result != pid) {
     107        fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d).  programming error\n", result, pid);
    87108        exit (1);
    88109      }
     
    101122  return (TRUE);
    102123}
    103 
    104 void DownHost (Host *host) {
    105   CLOSE (host[0].stdin);
    106   CLOSE (host[0].stdout);
    107   CLOSE (host[0].stderr);
    108   host[0].job = NULL;
    109   PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    110 }
    111 
    112 void OffHost (Host *host) {
    113   CLOSE (host[0].stdin);
    114   CLOSE (host[0].stdout);
    115   CLOSE (host[0].stderr);
    116   host[0].job = NULL;
    117   PutHost (host, PCONTROL_HOST_OFF, STACK_BOTTOM);
    118 }
Note: See TracChangeset for help on using the changeset viewer.