Thank you for the information...  I have that part working now however
Ive hit another road block...  

I have 3 threads that do different things with different files.  Those
routines are separated in my program.  When I go and grad all of the
files that need processing, I then spawn the threads to do the job of
handling the files.  After the spawning process, my processor spikes
100% and my memory usage slowly climbs...  Im doing something wrong...  

So here is my loosely based logic of what my program is doing.  I am
writing this program as an NT service for Windows 2003 server.  

While (ContinueRun()) {

Opendir(QUEUE, "directory") or die $!;

While (defined ( $file = readdir (QUEUE)) ) {
        
        If ($file =~ /^local/) {
                Push (@localData, $file);
        } 
        If ($file =~ /^remote/) {
                Push (@remoteData,$file);
        }

}

Closedir(QUEUE);

$thread1 = threads->create("local_sub",@localData);
$thread2 = threads->create("remote_sub",@remoteData);


$thread1->detach();
$thread2->detach();

# Sleep 10 seconds and check the que again for any other data.
Sleep(10);

}

Any suggestions of what I should do differently?


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of $Bill
Luebkert
Sent: Tuesday, April 11, 2006 11:01 PM
To: [email protected]
Subject: Re: Threads?

Foo Ji-Haw wrote:

> Qualifier (from doc): it counts only non-joined, non-detached threads.

The list function - but if you keep track of the threads you create and
their joinedness and detachedness :), you don't need anything else
including the list function.  Just add some bookkeeping.

> $Bill Luebkert wrote:
> 
>>Daniel Rychlik wrote:
>>
>>  
>>
>>>Hello,
>>>
>>>I'm curious is to how you get a thread count from perl threads... 
>>>
>>>Surely there has to be a way... 
>>>    
>>
>>I would think you would keep track of them as you create them.
>>
>>Couldn't you just use threads->list() ?
>>
>>my @ret = threads->list();
>>print scalar @ret, "\n";      # add one if you want to include the
main/base thread
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to