public void enqueue(BaseTask task)
 {
     lock (locker)
     {
         qTask.Enqueue(task);
     }
     handleWait.Set();
 }
Пример #2
0
        public void enqueue(BaseTask task)
        {
            lock (locker)
            {
                taskQueue.Enqueue(task);
            }

            eventWaitHandle.Set();
        }
Пример #3
0
        public void run()
        {
            while (running)
            {
                BaseTask task = null;

                lock (locker)
                {
                    if (taskQueue.Count > 0)
                    {
                        task = taskQueue.Dequeue();
                    }
                }

                if (task != null)
                {
                    task.execute();
                }
                else
                {
                    eventWaitHandle.WaitOne();
                }
            }
        }
        public void run()
        {
            while (running)
            {
                BaseTask task = null;

                lock (locker)
                {
                    if (0 < qTask.Count)
                    {
                        task = qTask.Dequeue();
                    }
                }

                if (task != null)
                {
                    task.execute();
                }
                else
                {
                    handleWait.WaitOne();
                }
            }
        }