private void ExecutionEngine() { VoidMethodHolder method = this.action; for (int cnt = 0; cnt < this.Counter; cnt++) { System.Console.Write("Thread: {0} - ", System.Environment.CurrentManagedThreadId); method(cnt + 1); if (cnt != this.Counter - 1) { System.Threading.Thread.Sleep(this.tickTimer); } } }
public AsyncTimer(int counter, int milliseconds, VoidMethodHolder method) { Counter = counter; Timer = milliseconds; action = method; }