public static void Recurse(WLData WordListData) { Mutex ThreadMx = new Mutex(); ThreadMx.WaitOne(); Threadmut.Add(ThreadMx); GenerateDictionary dict = new GenerateDictionary(); dict.Recurse(WordListData); ThreadMx.ReleaseMutex(); }
static void Main(string[] args) { int linit = 5, lend = 6; counterf = 0; GenerateDictionary dict = new GenerateDictionary(); counter = 0; Console.WriteLine("Init GenList"); Console.WriteLine("Calculated Pass: "******"Calculated Gigas: " + (((totalBytes / 1000) / 1000) / 1000).ToString()); Console.ReadLine(); file = new System.IO.StreamWriter(@"D:\GenList" + counterf.ToString() + ".txt", true); for (int Count = linit; Count <= lend; Count++) { Console.WriteLine("GenList Length: " + Count.ToString()); new ActionDelegateThreadsRecurse().ActionDelegate(new FooBarDelegateRecurse(Recurse), null, new WLData() { Length = Count, Position = 0, InitialCount = 0, BaseString = "", Process = WL, Match = SBStaticData.MatchAlphaNumericMin }); } bool ok = true; while (ok) { if (Threadmut.Count >= 1) { for (int i = 0; i <= Threadmut.Count; i++) { if (i >= Threadmut.Count) { ok = false; break; } if (Threadmut[i] != null) { Threadmut[i].WaitOne(); Threadmut[i].ReleaseMutex(); Threadmut[i].Close(); } } } else { Thread.Sleep(10); } } file.Flush(); file.Close(); Console.WriteLine("End GenList - Total Pass: " + totalPass.ToString()); Console.ReadLine(); }