#! perl -slw use strict; use threads qw[ async yield ]; use threads::shared; my $ready : shared = 0; async{ local $|=1; while( !$ready ) { do{ select undef, undef, undef, 0.2; printf "\r ($_)" } for qw[ / - \ | * ]; } print "\rReady"; $ready = 0; }->detach; for ( 1 .. 10 ) { ## Busy, busy, busy sleep 1; } $ready = 1; yield while $ready;