1 # Copyright (C) 2006-2008, The Perl Foundation.
6 examples/io/async_select.pir - Asynchronous Select Example
10 $ ./parrot examples/io/async_select.pir
14 This program is showing async select utilizing the io_thread event handler.
15 After you started the program, you will see a spinning progress marker,
16 showing that the program is idle. Type some chars at the console (due
17 to console buffering, you have to press <enter> too).
18 These chars will be displayed in bunches of four, as long as more chars are
23 .include 'io_thr_msg.pasm'
26 .local pmc handler, pio, data, pio_out
31 $S0 = pop pio # unbuffer
34 .const .Sub handler = "io_handler"
39 # the IO event is inactive, after it fired, just reattach always
40 add_io_event pio, handler, data, .IO_THR_MSG_ADD_SELECT_RD
52 # io_handler called by the select ready condition from event code
56 $S0 = read pio, 4 # arbitray - could of course read more
72 # vim: expandtab shiftwidth=4 ft=pir: