Changeset fb96152
- Timestamp:
- Apr 3, 2011, 3:06:00 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 8ba9313
- Parents:
- f2d71cfa
- git-author:
- Nelson Elhage <nelhage@nelhage.com> (02/24/11 09:59:45)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:00)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
select.c
rd4927a7 rfb96152 1 1 #include "owl.h" 2 #include <sys/stat.h> 2 3 3 4 static int dispatch_active = 0; … … 353 354 owl_select_psa_gc(); 354 355 return ret; 356 } 357 358 static void owl_select_prune_bad_fds(void) { 359 owl_list *dl = owl_global_get_io_dispatch_list(&g); 360 int len, i; 361 struct stat st; 362 owl_io_dispatch *d; 363 364 len = owl_list_get_size(dl); 365 for (i = 0; i < len; i++) { 366 d = owl_list_get_element(dl, i); 367 if (fstat(d->fd, &st) < 0 && errno == EBADF) { 368 owl_function_debugmsg("Pruning defunct dispatch on fd %d.", d->fd); 369 d->needs_gc = 1; 370 } 371 } 372 owl_select_io_dispatch_gc(); 355 373 } 356 374 … … 416 434 ret = pselect(max_fd+1, &r, &w, &e, &timeout, &mask); 417 435 418 if(ret < 0 && errno == EINTR) { 419 if(owl_global_is_interrupted(&g)) { 420 owl_select_handle_intr(NULL); 436 if(ret < 0) { 437 if (errno == EINTR) { 438 if(owl_global_is_interrupted(&g)) { 439 owl_select_handle_intr(NULL); 440 } 441 } else if (errno == EBADF) { 442 /* Perl must have closed an fd on us without removing it first. */ 443 owl_select_prune_bad_fds(); 421 444 } 422 445 sigprocmask(SIG_SETMASK, &mask, NULL);
Note: See TracChangeset
for help on using the changeset viewer.