private void queueTasks(int slot, int iter) { int cnt = counts[slot]; Task task = slots[slot]; for (int i = 0; i < cnt; i++) { Task next = task.next(); if (task.iter() == iter) { linkOut(task); queue.enqueue(task); } task = next; } }
public synchronized void schedule(Task task, double seconds) { if (task.isKilled()) { return; } if (seconds < 0.0) { throw new IllegalArgumentException("cannot schedule a Task in the past"); } int ticks = 1 + (int) (seconds * 10.0 + 0.5); if (isActive(task)) { linkOut(task); } task.slot((ticks + currSlot) & MASK); task.iter(currIter + ((ticks + currSlot) >> SHIFT)); linkIn(task); }
public synchronized void scheduleNow(Task task) { if (task.isKilled()) { return; } if (isActive(task)) { linkOut(task); } task.slot(SLOTS); task.iter(0); linkIn(task); }