| 691 | } |
| 692 | |
| 693 | int poll_select( int nfds, fd_set *readfds, fd_set *writefds, |
| 694 | fd_set *exceptfds, struct timeval *timeout) { |
| 695 | #ifdef FULL_ASYNC |
| 696 | |
| 697 | #else |
| 698 | struct timeval tv; |
| 699 | |
| 700 | fd_set readset; |
| 701 | fd_set errorset; |
| 702 | fd_set writeset; |
| 703 | |
| 704 | if( g_chain ) { |
| 705 | FD_ZERO(&readset); |
| 706 | FD_ZERO(&writeset); |
| 707 | FD_ZERO(&errorset); |
| 708 | |
| 709 | tv.tv_sec = 0; |
| 710 | tv.tv_usec = 0; |
| 711 | |
| 712 | int ret = ILibIterateChain( g_chain, readfds ? *readfds : readset, |
| 713 | writefds ? *writefds : writeset, |
| 714 | exceptfds ? *exceptfds: errorset, |
| 715 | timeout ? *timeout : tv ); |
| 716 | |
| 717 | // -2 is returned when the chain is not iterated due to locking. |
| 718 | if( ret != -2 ) { |
| 719 | return ret; |
| 720 | } else { |
| 721 | // pass through select doesnt work in threaded mode (currently) |
| 722 | // so if someone asked to do so fail the assert. |
| 723 | assert( nfds == 0 ); |
| 724 | return 0; |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | #endif |
| 729 | return select( nfds, readfds, writefds, exceptfds, timeout ); |
| 730 | } |
| 731 | |
| 732 | void poll_interrupt() { |
| 733 | if( g_chain != NULL ) { |