private void Enqueue(EntityQueue entity) { lock (syncLock) { EntityQueue.Enqueue(entity); } }
/// <summary> /// 开始监视队列 /// </summary> private void StartMonitor() { ThreadPool.QueueUserWorkItem(o => { while (true) { if (EntityQueue.Count > 0) { EntityQueue entityQueue = null; lock (syncLock) { entityQueue = EntityQueue.Dequeue() as EntityQueue; } if (entityQueue != null) { switch (entityQueue.sqlType) { case SqlType.Insert: break; case SqlType.Delete: break; case SqlType.Update: break; default: break; } } else { Thread.Sleep(100); } } else { Thread.Sleep(100); } } }); }