in reply to Re^3: How to Multiplex a Client using IO::Select
in thread How to Multiplex a Client using IO::Select

my $Qstdin = new Thread::Queue; async { $Qstdin->enqueue( $_ ) while defined( $_ = <STDIN> ); }->detach; In this code while waits for input. when does the thread context switch to while(1) loop??. It is looping in while defined ($_ = <STDIN>)
  • Comment on Re^4: How to Multiplex a Client using IO::Select

Replies are listed 'Best First'.
Re^5: How to Multiplex a Client using IO::Select
by Corion (Patriarch) on Oct 13, 2008 at 07:25 UTC

    The following code runs the thread asynchronously and detached:

    async { ... }->detach();

    This starts a separate thread that will read from STDIN and stuff the input into the queue.