- Timestamp:
- Mar 25, 2011, 3:55:41 AM (13 years ago)
- Children:
- b929e35
- Parents:
- 0af5f9d
- git-author:
- David Benjamin <davidben@mit.edu> (02/26/11 16:33:44)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/25/11 03:55:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
select.c
r96ade35 rbb54113 335 335 } 336 336 337 #if 0338 void owl_select(void)339 {340 int i, max_fd, max_fd2, aim_done, ret;341 fd_set r;342 fd_set w;343 fd_set e;344 fd_set aim_rfds, aim_wfds;345 struct timespec timeout;346 sigset_t mask;347 348 owl_select_process_timers(&timeout);349 350 owl_select_mask_signals(&mask);351 352 if(owl_global_is_interrupted(&g)) {353 owl_select_handle_intr(&mask);354 return;355 }356 FD_ZERO(&r);357 FD_ZERO(&w);358 FD_ZERO(&e);359 360 max_fd = owl_select_prepare_io_dispatch_fd_sets(&r, &w, &e);361 362 /* AIM HACK:363 *364 * The problem - I'm not sure where to hook into the owl/faim365 * interface to keep track of when the AIM socket(s) open and366 * close. In particular, the bosconn thing throws me off. So,367 * rather than register particular dispatchers for AIM, I look up368 * the relevant FDs and add them to select's watch lists, then369 * check for them individually before moving on to the other370 * dispatchers. --asedeno371 */372 aim_done = 1;373 FD_ZERO(&aim_rfds);374 FD_ZERO(&aim_wfds);375 if (owl_global_is_doaimevents(&g)) {376 aim_done = 0;377 max_fd2 = owl_select_aim_hack(&aim_rfds, &aim_wfds);378 if (max_fd < max_fd2) max_fd = max_fd2;379 for(i = 0; i <= max_fd2; i++) {380 if (FD_ISSET(i, &aim_rfds)) {381 FD_SET(i, &r);382 FD_SET(i, &e);383 }384 if (FD_ISSET(i, &aim_wfds)) {385 FD_SET(i, &w);386 FD_SET(i, &e);387 }388 }389 }390 /* END AIM HACK */391 392 if (owl_select_do_pre_select_actions()) {393 timeout.tv_sec = 0;394 timeout.tv_nsec = 0;395 }396 397 ret = pselect(max_fd+1, &r, &w, &e, &timeout, &mask);398 399 if(ret < 0 && errno == EINTR) {400 if(owl_global_is_interrupted(&g)) {401 owl_select_handle_intr(NULL);402 }403 sigprocmask(SIG_SETMASK, &mask, NULL);404 return;405 }406 407 sigprocmask(SIG_SETMASK, &mask, NULL);408 409 if(ret > 0) {410 /* AIM HACK: process all AIM events at once. */411 for(i = 0; !aim_done && i <= max_fd; i++) {412 if (FD_ISSET(i, &r) || FD_ISSET(i, &w) || FD_ISSET(i, &e)) {413 if (FD_ISSET(i, &aim_rfds) || FD_ISSET(i, &aim_wfds)) {414 owl_process_aim();415 aim_done = 1;416 }417 }418 }419 owl_select_io_dispatch(&r, &w, &e, max_fd);420 }421 }422 #endif423 424 337 void owl_select_init(void) 425 338 {
Note: See TracChangeset
for help on using the changeset viewer.