コード例 #1
0
 private void Enqueue(EntityQueue entity)
 {
     lock (syncLock)
     {
         EntityQueue.Enqueue(entity);
     }
 }
コード例 #2
0
        /// <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);
                    }
                }
            });
        }