public void enqueue(BaseTask task)
 {
     lock (locker)
     {
         qTask.Enqueue(task);
     }
     handleWait.Set();
 }
Exemplo n.º 2
0
        public void enqueue(BaseTask task)
        {
            lock (locker)
            {
                taskQueue.Enqueue(task);
            }

            eventWaitHandle.Set();
        }
Exemplo n.º 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();
                }
            }
        }