my $tid = threads->self->tid;
####
$q->enqueue( ( undef ) x $maxnoofThreads );
####
use strict;
use threads;
use threads::shared;
use Thread::Queue;
my $mtxStdOut : shared;
my $maxnoofThreads = 1;
my @clientList = qw(
client1 client2 client3 client4 client5 client6
client7 client8 client9 client10 client11 client12
);
my $q = new Thread::Queue;
my @workers = map {
threads->new( \&worker, $q );
} 1 .. $maxnoofThreads;
$q->enqueue(@clientList);
$q->enqueue( ( undef ) x $maxnoofThreads );
$_->join for @workers;
sub worker {
my( $Q ) = shift;
my $tid = threads->self->tid;
while( my $workItem = $Q->dequeue ) {
{
lock $mtxStdOut;
print " workitem from thread $tid -->$workItem\n";
}
## Perform query
## Perform comparison
## Perform output/cleanup
}
}