Example #1
0
 public Worker(Generator g, PostWorker pw, Object consoleLocker)
 {
     this.generator = g;
     this.r = new Random ();
     this.pw = pw;
     this.consoleLocker = consoleLocker;
 }
        public MultiGenerator()
        {
            Generator g = new Generator (200);
            PostWorker pw = new PostWorker (50, consoleLocker);
            ts = new Thread[Environment.ProcessorCount * 2];

            for (int i = 0; i < ts.Length; ++i) {
                ts[i] = new Thread(new Worker (g, pw, consoleLocker).run);
                ts[i].Name = "Worker : " + i;
            }
        }