Changeset 3a84694
- Timestamp:
- May 4, 2009, 9:55:17 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- bf66f4e
- Parents:
- d6bd3f1
- git-author:
- Nelson Elhage <nelhage@mit.edu> (05/04/09 20:24:31)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (05/04/09 21:55:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
select.c
radee9cc r3a84694 41 41 } 42 42 43 void owl_select_process_timers(struct time val*timeout)43 void owl_select_process_timers(struct timespec *timeout) 44 44 { 45 45 time_t now = time(NULL); … … 79 79 } 80 80 81 timeout->tv_ usec = 0;81 timeout->tv_nsec = 0; 82 82 } 83 83 … … 287 287 } 288 288 289 void owl_select_handle_intr() 290 { 291 owl_input in; 292 in.ch = in.uch = owl_global_get_startup_tio(&g)->c_cc[VINTR]; 293 owl_process_input_char(in); 294 } 295 289 296 void owl_select() 290 297 { 291 int i, max_fd, aim_max_fd, aim_done ;298 int i, max_fd, aim_max_fd, aim_done, ret; 292 299 fd_set r; 293 300 fd_set e; 294 301 fd_set aim_rfds, aim_wfds; 295 struct timeval timeout; 302 struct timespec timeout; 303 sigset_t mask, intr; 304 305 sigemptyset(&intr); 306 sigaddset(&intr, SIGINT); 296 307 297 308 owl_select_process_timers(&timeout); 309 310 sigprocmask(SIG_BLOCK, &intr, &mask); 311 if(owl_global_is_interrupted(&g)) { 312 owl_select_handle_intr(); 313 return; 314 } 298 315 299 316 max_fd = owl_select_dispatch_prepare_fd_sets(&r, &e); … … 325 342 /* END AIM HACK */ 326 343 327 if ( select(max_fd+1, &r, &aim_wfds, &e, &timeout) ) { 328 owl_global_unset_interrupted(&g); 344 345 ret = pselect(max_fd+1, &r, &aim_wfds, &e, &timeout, &mask); 346 347 if(ret < 0 && errno == EINTR) { 348 if(owl_global_is_interrupted(&g)) { 349 owl_select_handle_intr(); 350 } 351 return; 352 } 353 354 sigprocmask(SIG_UNBLOCK, &intr, NULL); 355 356 if(ret > 0) { 329 357 /* Merge fd_sets and clear AIM FDs. */ 330 358 for(i = 0; i <= max_fd; i++) {
Note: See TracChangeset
for help on using the changeset viewer.