in reply to Re^3: How to Multiplex a Client using IO::Select
in thread How to Multiplex a Client using IO::Select
The second and third timeout should be zero. Better yet, you can combine the three system calls into one:
while( 1 ) { if ( my ($readers, $writers, $exceptors) = IO::Select::select($selector, $selector, $selector, 0.1) ) { for( @$readers ) { ## See what they have to say } for( @$writers ) { ## Tell'em what they need to know } for( @$exceptors ) { ## Deal with their tantrums } } if( $Qstdin->pending ) { my $kbinput = $Qstdin->dequeue; ## do whatever } }
Another possible improvement would be to ditch Thread::Queue in favour of a Win32::Socketpair "pipe".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to Multiplex a Client using IO::Select
by BrowserUk (Patriarch) on Oct 13, 2008 at 10:40 UTC | |
by ikegami (Patriarch) on Oct 13, 2008 at 13:48 UTC | |
by BrowserUk (Patriarch) on Oct 13, 2008 at 14:49 UTC | |
by ikegami (Patriarch) on Oct 13, 2008 at 14:55 UTC | |
by BrowserUk (Patriarch) on Oct 13, 2008 at 15:55 UTC | |
by muthuma (Novice) on Oct 13, 2008 at 12:38 UTC | |
by BrowserUk (Patriarch) on Oct 13, 2008 at 13:26 UTC | |
by muthuma (Novice) on Oct 14, 2008 at 05:52 UTC | |
by ikegami (Patriarch) on Oct 13, 2008 at 13:39 UTC |