Changeset 41340 for trunk/Ohana/src/opihi/lib.data/open_kapa.c
- Timestamp:
- Apr 16, 2020, 1:54:47 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.data/open_kapa.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.data/open_kapa.c
r41162 r41340 266 266 int close_kapa (char *name) { 267 267 268 struct timespec request, remain;269 268 int N; 270 269 … … 275 274 } 276 275 DelKapaDevice (name); 277 278 // avoid blocking on waitpid, test every 1 msec, up to 500 msec279 request.tv_sec = 0;280 request.tv_nsec = 1000000;281 282 // try to harvest the child PID283 int waitstatus = 0;284 int result = waitpid (-1, &waitstatus, WNOHANG);285 for (int i = 0; (i < 500) && (result == 0); i++) {286 nanosleep (&request, &remain);287 result = waitpid (-1, &waitstatus, WNOHANG);288 }289 290 if ((result == -1) && (errno != ECHILD)) {291 fprintf (stderr, "unexpected error from waitpid (%d): programming error\n", errno);292 }293 if (result == 0) {294 fprintf (stderr, "child did not exit (close_kapa), timeout");295 }296 297 276 return (TRUE); 298 277 }
Note:
See TracChangeset
for help on using the changeset viewer.
