Changes in select.c [40bda84:27f6487]
Legend:
- Unmodified
- Added
- Removed
-
select.c
r40bda84 r27f6487 152 152 } 153 153 154 int owl_select_dispatch_count( void)154 int owl_select_dispatch_count() 155 155 { 156 156 return owl_list_get_size(owl_global_get_dispatchlist(&g)); … … 205 205 FD_ZERO(e); 206 206 max_fd = 0; 207 len = owl_select_dispatch_count( );207 len = owl_select_dispatch_count(g); 208 208 for(i = 0; i < len; i++) { 209 209 d = owl_list_get_element(dl, i); … … 215 215 } 216 216 217 void owl_select_gc( void)217 void owl_select_gc() 218 218 { 219 219 int i; … … 325 325 } 326 326 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) 327 void owl_select_handle_intr() 337 328 { 338 329 owl_input in; 339 330 340 331 owl_global_unset_interrupted(&g); 341 342 sigprocmask(SIG_SETMASK, restore, NULL); 332 owl_function_unmask_sigint(NULL); 343 333 344 334 in.ch = in.uch = owl_global_get_startup_tio(&g)->c_cc[VINTR]; … … 346 336 } 347 337 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) 338 void owl_select() 356 339 { 357 340 int i, max_fd, aim_max_fd, aim_done, ret; … … 364 347 owl_select_process_timers(&timeout); 365 348 366 owl_select_mask_signals(&mask); 367 368 owl_select_check_tstp(); 349 owl_function_mask_sigint(&mask); 369 350 if(owl_global_is_interrupted(&g)) { 370 owl_select_handle_intr( &mask);351 owl_select_handle_intr(); 371 352 return; 372 353 } … … 400 381 /* END AIM HACK */ 401 382 383 402 384 ret = pselect(max_fd+1, &r, &aim_wfds, &e, &timeout, &mask); 403 385 404 386 if(ret < 0 && errno == EINTR) { 405 owl_select_check_tstp();406 387 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 } 410 390 return; 411 391 } 412 392 413 sigprocmask(SIG_SETMASK, &mask,NULL);393 owl_function_unmask_sigint(NULL); 414 394 415 395 if(ret > 0) {
Note: See TracChangeset
for help on using the changeset viewer.