Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • select.c

    r40bda84 r27f6487  
    152152}
    153153
    154 int owl_select_dispatch_count(void)
     154int owl_select_dispatch_count()
    155155{
    156156  return owl_list_get_size(owl_global_get_dispatchlist(&g));
     
    205205  FD_ZERO(e);
    206206  max_fd = 0;
    207   len = owl_select_dispatch_count();
     207  len = owl_select_dispatch_count(g);
    208208  for(i = 0; i < len; i++) {
    209209    d = owl_list_get_element(dl, i);
     
    215215}
    216216
    217 void owl_select_gc(void)
     217void owl_select_gc()
    218218{
    219219  int i;
     
    325325}
    326326
    327 void owl_select_mask_signals(sigset_t *oldmask) {
    328   sigset_t set;
    329 
    330   sigemptyset(&set);
    331   sigaddset(&set, SIGINT);
    332   sigaddset(&set, SIGTSTP);
    333   sigprocmask(SIG_BLOCK, &set, oldmask);
    334 }
    335 
    336 void owl_select_handle_intr(sigset_t *restore)
     327void owl_select_handle_intr()
    337328{
    338329  owl_input in;
    339330
    340331  owl_global_unset_interrupted(&g);
    341 
    342   sigprocmask(SIG_SETMASK, restore, NULL);
     332  owl_function_unmask_sigint(NULL);
    343333
    344334  in.ch = in.uch = owl_global_get_startup_tio(&g)->c_cc[VINTR];
     
    346336}
    347337
    348 void owl_select_check_tstp() {
    349   if(owl_global_is_sigstp(&g)) {
    350     owl_function_makemsg("Use :suspend to suspend.");
    351     owl_global_unset_got_sigstp(&g);
    352   }
    353 }
    354 
    355 void owl_select(void)
     338void owl_select()
    356339{
    357340  int i, max_fd, aim_max_fd, aim_done, ret;
     
    364347  owl_select_process_timers(&timeout);
    365348
    366   owl_select_mask_signals(&mask);
    367 
    368   owl_select_check_tstp();
     349  owl_function_mask_sigint(&mask);
    369350  if(owl_global_is_interrupted(&g)) {
    370     owl_select_handle_intr(&mask);
     351    owl_select_handle_intr();
    371352    return;
    372353  }
     
    400381  /* END AIM HACK */
    401382
     383
    402384  ret = pselect(max_fd+1, &r, &aim_wfds, &e, &timeout, &mask);
    403385
    404386  if(ret < 0 && errno == EINTR) {
    405     owl_select_check_tstp();
    406387    if(owl_global_is_interrupted(&g)) {
    407       owl_select_handle_intr(NULL);
    408     }
    409     sigprocmask(SIG_SETMASK, &mask, NULL);
     388      owl_select_handle_intr();
     389    }
    410390    return;
    411391  }
    412392
    413   sigprocmask(SIG_SETMASK, &mask, NULL);
     393  owl_function_unmask_sigint(NULL);
    414394
    415395  if(ret > 0) {
Note: See TracChangeset for help on using the changeset viewer.