[Pdx-pm] Q about ithreads && signals

Joshua Hoblitt jhoblitt at ifa.hawaii.edu
Sun Nov 17 15:52:21 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:

Well it's threads or forks... the data has to be given out again.  I decided to play with threads.  In the medium term the data will have to be aquired from multiple sources and averaged.

>   &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;
>   }

Very slick! I'll try this.

> If the source data is really changing every ten seconds, though, maybe
> http isn't the best way to transfer it from site to site. Can you put a
> program onto the source machine? A very simple server could do the trick:
> A client connects to its port, and the server sends the data down the pipe
> every time it changes. Pretty straightforward TCP socket stuff should do
> the trick.

The short answer is no.  I'm stuck with talking to a crappy old HTTP server in another organization thats probably ~1995 vintage. The good news is the data set is tiny (about 1K).  The problem I'm trying to solve is reducing the load on the crappy server.  I'm only severing it back up as http again because of legacy clients on our end - this will change with time.

> Good luck with it!

Thanks for your Help!


More information about the Pdx-pm-list mailing list