static void Action() { while (true) { AsyncInvoke asyncInvoke = new AsyncInvoke(Delegate); asyncInvoke.Invoke(); GC.Collect(); Thread.Sleep(10 * 1000); } }
public void ProcessQueue() { if (_syncThread != Thread.CurrentThread) { throw new Exception("must be called from the same thread it was created on"); } AsyncInvoke data = null; while (true) { lock (_toExecuteQueue) { if (_toExecuteQueue.Count == 0) { break; } data = _toExecuteQueue.Dequeue(); } data.Invoke(); } }