Thanks for your inputs...
Well i still haven't finalized the strategy yet... i just wanted some inputs .. in my case there are thousands of queries and numerous clients. Each query <CLIENT> placeholder which must be replaced at runtime and then fired and outputs compared . I just wanted to separate the query firing and the comparision processes.
Also in the model that u have proposed how do i add support for handling multiple queries,i can use the same strategy as i had used before...
use strict; use threads; use threads::shared; use Thread::Queue; my $maxnoofThreads = 1; my @clientList = qw(client1 client2 client3 client4 client5 client6 + client7 client8 client9 client10 client11 client12); my %hash; my $q = new Thread::Queue; $q->enqueue(@clientList); for(my $i=0;$i<= $maxnoofThreads; $i++) { $hash{$i} = threads->new( \&worker, $q,$i); } $q->enqueue("undef"); foreach my $thr (values %hash) { # Don't join the main thread or ourselves #if ($thr->tid && !threads::equal($thr, threads->self)) # { $thr->join; # } } sub worker { my( $Q ) = shift; my $i = shift; while( my $workItem = $Q->dequeue ) { return unless($workItem); print " workitem from thread $i -->$workItem\n"; ## Perform query ## Perform comparison ## Perform output/cleanup } }
In reply to Re^6: Problem in Inter Process Communication
by libvenus
in thread Problem in Inter Process Communication
by libvenus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |