Changeset 8424 for trunk/Ohana/src/opihi/pcontrol/StopHosts.c
- Timestamp:
- Aug 18, 2006, 1:44:51 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/StopHosts.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/StopHosts.c
r8296 r8424 19 19 int DownHosts () { 20 20 21 int i, Nobject;22 21 Stack *stack; 23 22 Host *host; … … 68 67 int HarvestHost (int pid) { 69 68 70 int result; 71 int waitstatus; 69 int i, result, waitstatus; 72 70 73 /* I probably should loop a few time with max timeout larger than 10ms... */ 74 usleep (10000); 75 result = waitpid (pid, &waitstatus, WNOHANG); 71 gprint (GP_ERR, "harvesting within thread %d\n", pthread_self()); 72 gprint (GP_ERR, "child process %d is down, wait for exit status\n", pid); 73 74 // Loop a few times waiting for child to exit 75 for (i = 0; i < 50; i++) { 76 result = waitpid (pid, &waitstatus, WNOHANG); 77 if ((result == -1) && (errno == ECHILD)) { 78 usleep (10000); 79 continue; 80 } else { 81 break; 82 } 83 } 76 84 switch (result) { 77 85 case -1: /* error with waitpid */ … … 81 89 gprint (GP_ERR, "did process already exit? programming error?\n"); 82 90 break; 91 case EINTR: 83 92 case EINVAL: 84 gprint (GP_ERR, "error EINVAL (waitpid): programming error\n");85 exit (1);86 case EINTR:87 gprint (GP_ERR, "error EINTR (waitpid): programming error\n");88 exit (1);89 93 default: 90 gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno);91 exit (1);94 perror ("unexpected error"); 95 ABORT ("(HarvestHost)"); 92 96 } 93 97 break;
Note:
See TracChangeset
for help on using the changeset viewer.
