fernandes has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; system("clear"); desperta{ #en: wakeup my $tempo_inicial = time; my $tempo_limite = shift; while (time<($tempo_inicial+$tempo_limite)){ print "Enquanto resta ", -(time-($tempo_inicial+$tempo_limite)), " + segundos para acordar, porque não dormes?\n"; #en: 'Why don't you sleep while you have ', time, ' second(s) for +that?' my $tempo_inicial_interno = time; while (time<($tempo_inicial_interno+1)){ #não faz nada enquanto não transcorrer 1 segundo #en: waits 1 second }; system("clear"); }; while(1){ $a=1; while($a<1500){ #print $a, "\n"; print "ACORDA "; #en: WAKEUP $a++; } print chr hex 7; }; }; 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wakeup: event-loop system
by GrandFather (Saint) on Mar 01, 2009 at 02:11 UTC | |
by Anonymous Monk on Mar 01, 2009 at 05:09 UTC | |
by GrandFather (Saint) on Mar 01, 2009 at 19:00 UTC | |
|
Re: Wakeup: event-loop system
by locked_user sundialsvc4 (Abbot) on Mar 01, 2009 at 05:46 UTC | |
by fernandes (Monk) on Mar 01, 2009 at 14:10 UTC | |
|
Re: Wakeup: event-loop system
by zentara (Cardinal) on Mar 01, 2009 at 15:26 UTC |