Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • select.c

    r27f6487 r40bda84  
    152152}
    153153
    154 int owl_select_dispatch_count()
     154int owl_select_dispatch_count(void)
    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(g);
     207  len = owl_select_dispatch_count();
    208208  for(i = 0; i < len; i++) {
    209209    d = owl_list_get_element(dl, i);
     
    215215}
    216216
    217 void owl_select_gc()
     217void owl_select_gc(void)
    218218{
    219219  int i;
     
    325325}
    326326
    327 void owl_select_handle_intr()
     327void 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
     336void owl_select_handle_intr(sigset_t *restore)
    328337{
    329338  owl_input in;
    330339
    331340  owl_global_unset_interrupted(&g);
    332   owl_function_unmask_sigint(NULL);
     341
     342  sigprocmask(SIG_SETMASK, restore, NULL);
    333343
    334344  in.ch = in.uch = owl_global_get_startup_tio(&g)->c_cc[VINTR];
     
    336346}
    337347
    338 void owl_select()
     348void 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
     355void owl_select(void)
    339356{
    340357  int i, max_fd, aim_max_fd, aim_done, ret;
     
    347364  owl_select_process_timers(&timeout);
    348365
    349   owl_function_mask_sigint(&mask);
     366  owl_select_mask_signals(&mask);
     367
     368  owl_select_check_tstp();
    350369  if(owl_global_is_interrupted(&g)) {
    351     owl_select_handle_intr();
     370    owl_select_handle_intr(&mask);
    352371    return;
    353372  }
     
    381400  /* END AIM HACK */
    382401
    383 
    384402  ret = pselect(max_fd+1, &r, &aim_wfds, &e, &timeout, &mask);
    385403
    386404  if(ret < 0 && errno == EINTR) {
     405    owl_select_check_tstp();
    387406    if(owl_global_is_interrupted(&g)) {
    388       owl_select_handle_intr();
    389     }
     407      owl_select_handle_intr(NULL);
     408    }
     409    sigprocmask(SIG_SETMASK, &mask, NULL);
    390410    return;
    391411  }
    392412
    393   owl_function_unmask_sigint(NULL);
     413  sigprocmask(SIG_SETMASK, &mask, NULL);
    394414
    395415  if(ret > 0) {
Note: See TracChangeset for help on using the changeset viewer.