Changeset 4684 for trunk/Ohana/src/opihi/pantasks/LocalJob.c
- Timestamp:
- Jul 31, 2005, 8:04:11 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/LocalJob.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r4602 r4684 102 102 int result, waitstatus; 103 103 104 fprintf (stderr, "checking on %d\n", job[0].pid); 105 104 106 /* check local job status */ 105 107 result = waitpid (job[0].pid, &waitstatus, WNOHANG); … … 135 137 exit (1); 136 138 } 139 fprintf (stderr, "waited for %d\n", result); 137 140 138 141 if (WIFEXITED(waitstatus)) { … … 151 154 return; 152 155 } 156 157 int KillLocalJob (Job *job) { 158 159 int i, result, waitstatus; 160 161 if (job[0].state != JOB_BUSY) return (TRUE); 162 163 /* send SIGTERM signal to job */ 164 kill (job[0].pid, SIGTERM); 165 result = 0; 166 for (i = 0; (i < 10) && (result == 0); i++) { 167 usleep (10000); /* 10 ms is min */ 168 result = waitpid (job[0].pid, &waitstatus, WNOHANG); 169 } 170 if (result) return (TRUE); 171 172 /* send SIGKILL signal to job */ 173 kill (job[0].pid, SIGKILL); 174 result = 0; 175 for (i = 0; (i < 10) && (result == 0); i++) { 176 usleep (10000); /* 10 ms is min */ 177 result = waitpid (job[0].pid, &waitstatus, WNOHANG); 178 } 179 if (result) return (TRUE); 180 181 /* total failure, don't reset */ 182 return (FALSE); 183 } 184
Note:
See TracChangeset
for help on using the changeset viewer.
