public void enqueue(BaseTask task) { lock (locker) { qTask.Enqueue(task); } handleWait.Set(); }
public void enqueue(BaseTask task) { lock (locker) { taskQueue.Enqueue(task); } eventWaitHandle.Set(); }
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(); } } }