Sorry I never replied, I had computer trouble and was sick at the same time.

Ur sure the first thread is doing work?  Put in some code in each thread to
print out a status message like "thread 3 idle" and "thread 5 got payload,
working...".  Also check the number of queue items with $q->pending. U don't
need to share the queue variable.  Let me know if it's still not working and
post some more detailed code.

At 11:36 PM 12/15/2006 -0800, [EMAIL PROTECTED] wrote:
>10 threads. The problem is only one thread is being used, and all jobs are
queud
>up in a line behind the first. Each job is a subroutine call. How can I create
>this to be multi-tasking? ..eg jobs being executed non-blocking as threads
being
>used as available.
>----my code---
>
>my $wthrsz : shared = 0;
>my $psize : shared = 10;
>my $thrQ : shared = new Thread::Queue;
>my @thr;
>
>
>sub createthrp {
>       ($psize) = @_;
>       my $nbr = 0;
>       for(1..$psize)
>       {
>               $thr[$nbr] = threads->create("entrypoint");     
>               $nbr++;
>       }
>       
>}
>
>
>sub entrypoint {        
>        for (;;) {
>               $payload = $thrQ->dequeue_nb;
>               Win32::Sleep(100) and next unless $payload;
>               $wthrsz++;
>               &$payload;
>               $wthrsz--;
>       }
>}
>
>
>while(1)
>{
>#...
>$thrQ->enqueue(codehere($param));
>#...
>}
>
>




--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to