[Pdx-pm] Q about ithreads && signals

Joshua Hoblitt jhoblitt at ifa.hawaii.edu
Sun Nov 17 15:53:59 CST 2002


> It's not a lot of cpu power. It's not even a need for threads and signals.
> Dress this up as needed:

sleep is probably a singal :)

>   &do_query;
>   my $next_query = time + 10;
>   while (1) {
>     # Wait until it's time...
>     my $now = time;
>     if ($now < $next_query) {
>       # It's not time yet
>       sleep($next_query - $now);
>     } elsif ($now > $next_query) {
>       # Missed the moment. Do whatever you need to do for that case.
>     }
>     &do_query;
>     $next_query += 10;
>   }




More information about the Pdx-pm-list mailing list