Click here to Skip to main content
15,917,618 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am writing an application that runs through 8chracter words(starting randomly) and stops if a word had been found that complies with the PasswordPolicy, now how do I make this multithreaded?

foreach (string word in GetWords(8))
{
  if (CheckPasswordPolicy(word))
   {
    MessageBox.Show(word);
     return;
   }
}


Greets,
Wim.
Posted

Look into using a BackgroundWorker object. I would give you specific code, but there are plenty of examples on the internet. Just use google to find them.
 
Share this answer
 
How can I use let's say 10 threads and stop everything if 1 thread finds my word?

From JSOP: It would be fairly pointless to run multiple threads to search through the same list. In fact, using a thread to do this at all seems like a questionable design decision, because I assume that you're running through the list in response to the user entering a password. You probably don't want him to proceed until the password has been checked against the list, so why create all that overhead and work by putting it in a thread?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900