public void WorkerThread() { while (isRunning) { if (statements.Count > 0) { DatabaseAction action = null; if (statements.Dequeue(out action)) { action.Action.Invoke(); } else { Thread.Sleep(10); } } else { Thread.Sleep(10); } } }
public void AddAction(DatabaseAction action) { statements.Enqueue(action); }