|
-
November 1st, 2006, 12:29 PM
#1
Threading in a loop?...possible?
Basically I want to enumerate a bunch of files in a directory and run a thread on each file only once. So when I use a file I decrease the count by 1, and keep running till 0.
My understanding of threading is a little weak, but can I not just make an infinte loop until count =0? and when Threadstate=Stopped re-start it? (.net 2.0)
Code:
do
{
filename = files[count];
if (t1.ThreadState == ThreadState.Stopped)
{
t1.Start();
}
if (count == 0)
writer.Close();
} while (count != 0);
(count-- in the thread function)
Or am I going about this the wrong way...
Thanks,
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|